Closed (fixed)
Project:
webReader
Version:
6.x-1.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Jun 2009 at 21:42 UTC
Updated:
12 Jun 2010 at 00:48 UTC
This is the strangest bug that took me forever to figure out the cause of. When webreader is present, any page listing with embedded nodes replaces the title of the page with the title of the node. So for instance, if I have a view listing a nodes, the title of the view page is replaced with the title of the last node.
I suspect it might be this bit of code that is the problem but I have no idea how to go about fixing it. This is happening on pages where webreader isn't enabled.
// Get real node title and insert webReader tags for output of node title
$nodetitle = $node->title;
drupal_set_title('<!-- RSPEAK_START -->'. $nodetitle .'<!-- RSPEAK_STOP -->');
Comments
Comment #1
Dejarl commentedHi,
It doesn't happen for me, but since it only happens when webReader is disabled I think this is how you can solve the problem:
Cut this code:
Paste it just below the "IF" that check if the plugin is activated or not, it should look like this:
I hope that this will solve the problem since the plugin will only work with the title if webReader is displayed.
Comment #2
techczech commentedThanks for the quick response. This only solved the problem partially. First, this was happening when Webreader was enabled and fixed itself when I disabled it. Your solution fixed the problem with views listings when only individual fields are presesnt but not when the whole node object is loaded.
The way to replicate is create a view that displays the whole node and is set to one node per page. (See http://www.dyslexiatraining.com/courses/listings/hornsby where the title of the view is taken over by the view).
It's not a problem with this particular view but is more of an issue when I use the nodereference field to display the teaser rather than just the node.
I think the problem is passing the
$titlevariable to thedrupal_set_title()function since when the embedded node is present, the available title variable comes from the embedded node. I think the solution might be somewhere in drupal_get_title() function but I'm not sure exactly where.BTW: This also had an interesting consequence in what is read. Whereas before it just read the node title and body (desired behavior), now it starts at the top of the page.
Comment #3
techczech commentedProblem solved! Just as I pressed save on the last posting, the solution appeared to me as if by magic. The problem was exactly as I thought and the fix is simply getting the node variable out of the
drupal_get_title()function. So the fix is simply changin the line from:$nodetitle = $node->title;to the following:
$nodetitle = drupal_get_title();It even works when I move the original line back where it was. But then it only seems to read the title (which is something that was sporadically happening before but fixed itself after a while. So I'll see how things go.
Comment #5
mediamike commentedI installed webreader in the normal way. After that, the titles being shown on all my pages were incorrect. So I just disabled the module and it started working again. Not worth it for 4 hours a month of automatic reading.