Closed (fixed)
Project:
Page Title
Version:
5.x-2.0-alpha6
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Jun 2008 at 17:36 UTC
Updated:
9 Oct 2008 at 16:33 UTC
My home page is a panel containing several views. The views are content from different types of nodes.
Since activating module Page Title, the page home page's browser title is now the page title of ONE of the nodes on the page -- and an odd choice, one of the blog posts that is halfway down the page.
WHAT'S GOING ON?
It would be ideal if the Panel could have a Page Title field. But lacking that, it should not be grabbing a random title from one of the nodes on the page.
This is really messing up the home page. How can I remove the incorrect page title and revert to the panel title?
Many of the nodes (but not all) now have a Page Title, while some just use the node title as page title.
Comments
Comment #1
hawkdrupal commentedMore on Panel bug...
If I remove the Page Title from the blog posting, the entire panel page's title reverts to what it should be the -- true title of the panel.
If I add/change a Page Title in a different blog posting on the panel page, nothing happens. Only the one blog node seems to control the entire page title of the panel page. It happens to be the last blog node in the view on the page. So...
Maybe Page Title is looking up ALL page title values for all the nodes on the page (a panel comprised of several views), then, finding many such values, uses the last one as the displayed Page Title. This can't be what is intended...
As a workaround I'm diddling with how to exclude Page Title from this page. But perhaps this problem is happening in a variety of situations where a single page has multiple Page Title values?
Comment #2
hawkdrupal commentedI seem to be able to suppress the wrong Page Title by modifying the line in template.php that is required to invoke Page Title:
This is a quick fix to an urgent problem, so there might be a lurking problem or a better solution.
Comment #3
nicholasthompsonare your views displaying full nodes rather than teasers?
Comment #4
nicholasthompsonMarking as need more info so I can keep my issue list organised...
Comment #5
hawkdrupal commentedThe problem is on a panel, using Panels module 5.x-1.2.
The panel has many elements, mostly views, but a few blocks.
The views on this panel show only teasers.
You can see it at http://www.advisor.com, and at http://www.advisor.com/boomer which is the panel where I most want to control the page title.
Also note this is 5.x-1.1, which I thought I specified in the original post, though it now says 6...
Comment #6
nicholasthompsonHmm this is an odd problem.
For starters, the frontpage, with Page Title, should pick-up the value from a completely separate field.
Integrating (as a feature request) is an in-progress thing for Page Title 2...
Comment #7
hawkdrupal commentedMy patch seems to eliminate the problem on http://www.advisor.com/boomer, but it essentially does this by disabling Page Title on this page, which is unfortunate, because I really need to separate them.
What makes this difficult to patch is that a Panel isn't easy to identify.
Please consider my "hunch" that the Panel has many node Titles, at least one per embedded View, perhaps stacking up in an unintended array of titles. One of the titles might be the intended Page Title, but if it's not expecting to have several to choose from, perhaps Page Title ends up using the first or last which is not the "right" one.
Does your module's Page Title field value sometimes get mixed in with Drupal's node Title field value(s), raising the possibility that the wrong title is chosen for display?
Comment #8
nicholasthompsonSome things to note:
1) Page Title will assume a node's title is the Node Title rather than the Page Title field IF the Page Title field is blank...
2) Page Title only gets the title from the node if a node is being viewed as a page (see Line 128)
Could you paste in your _phptemplate_variables function from template.php please?
Comment #9
hawkdrupal commentedHere it is:
Comment #10
nicholasthompson1) $drupal_title is an undefined variable so by saying "!$drupal_title" you basically saying "NOT NULL" which is the same as true, causing the if statement to render "TRUE" for ALL phptemplate_variable requests.... read 2 for why this is page...
2) the
drupal_is_front_page()check is NOT a good idea in here... If you visit the frontpage, the_phptemplate_variablesgets called severl times with hooks such a page, node, box, comment, block and probably more... But in each call its still the frontpage so thehead_titlewill get set and, more importantly,page_title_page_get_title()will get called for each one, probably causing token related issues which, in turn, is probably causing your node title problems.If you follow to documentation for the module you should see that the code to go in this function simple looks for the page hook - this is VERY important!
Try replacing the function with this (assuming you've provided the complete function above):
I'm marking this as fixed because I believe that is the problem - that Page Title is getting called too many times on a page and thus the page title token stuff is not functioning correctly...
Please reopen if this doesn't fix your problem.
Comment #11
hawkdrupal commentedI guess my situation is misunderstood. You are focusing on my crude attempt to FIX Page Title. That's not a problem, that's a possible solution. My report is about a problem in Page Title 5.x-1.1, UNMODIFIED.
I orignally put in your function, exactly as you provide it in your instructions for installing Page Title. It was that UNMODIFIED version that caused the problem with a Panel page showing an incorrect page title.
My modification of the function is simply an attempt to get rid of the problem on Panel pages, so I don't have to disable Page Title entirely. My modification works, though you're probably right, it's not a good solution. But it does the job of not allowing Page Title to override the node title on a Panel, while not breaking Page Title elsewhere. The mod seems to have NO effect on any other type of node. They all display Page Title, if there is one, otherwise node title. My report to you is not about my mod (good or bad), sorry to have mentioned it.
Repeating the actual problem (in my original post):
Page Title, unmodified, does not work correctly with a Panel. It does not show the Page Title field's value, it shows a page title that is one of the nodes in one of the views on the Panel.
Comment #12
nicholasthompsonI didn't realise it was V1.1, got confused sorry...
My point still stands though that the module will function correctly using the template.php code I provided rather than your modification.
Your mod calls the page_get_title function for ALL hooks. I believe all the node hooks come BEFORE the page hook - especially if you have a lot listed as you do. Here is the code...
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/page_title/...
Now... Note how this function statically caches the title. This means that if a page title is generated for a non-page hook then it will be remembered and produced on the next call.
How are the nodes listed on that panel? Views?
I'm sorry your having these problems and I will try my best to help you but my concern here is that I and many friends have use Panels + Views + Drupal 5 + Page Title 1.1 and have had ZERO problems. You would also think that others may have opened similar threads in the past year about it too... I just find it a little odd that you appear to be the only one. This, to me, implies that there is something special or different about your system. What? I dont know yet...
IIRC (I stopped using 1.1 a long time ago), There are two templates. Default and Frontpage. Within this (say default) template you should have it set to maybe "
!page_title | mysite.com". Now, if you set the Panel Title to "flibble". When you visit this Page Title will take the default title from drupal_get_title(). It then looks in its static internal cache for Page Title (a function with a static variable). This function in turn ONLY stores a title for a node which is views in PAGE mode - this means a node being shown standalone. Note: STANDALONE, Teaser of Full View is irrelevant - you can have many nodes view in full without them being standalone PAGES.Now as this Panel looks like it has Views in teasers then I can safely assume that hook_nodeapi is being called for each one, but as they're not standalone nodes then the $page argument should be FALSE and not TRUE (as it would be for a node/xxx URL). Therefore Page Title shouldn't statically cache a node's page title.
Instead, therefore, it should fall back to the drupal_get_title() result. This should be the Panel Title which will then get inserted into your default template when you configured Page Title.
Now there is ONE bug I have just seen (and recall being submitted too actually). There is no !page_title "token" for the FRONTPAGE. This is because - at the time - I didn't think you could set one... turns out you can, say if you promote a node as the frontpage in Site Information. This might explain your frontpage problems?!
What are your default and frontpage token setup as?
Do you have the Token Module installed on your site (say for use with PathAuto)? If so, you could try upgrading to Page Title 2 (not the dev, get the latest alpha). This uses Tokens and is FAR better. We're using Alpha5 on www.pponline.co.uk and it works perfectly.
Comment #13
hawkdrupal commentedI just removed my mod and reverted to your exact function phptemplate_variable. Instantly, the Panels page title switches to showing the title of one particular node teaser that is on the page.
The Panel-based page is http://www.advisor.com/boomer, and with Page Title unmodified, the page title is "The sad end of Microsoft Windows XP", which is NOT actually the Page Title specified for the Panel. Look at the URL and notice this is the title of a blog posting teaser that is shown via a view (one of many) on the page. How does it get used by Page Title for the entire page??
If I edit the title of this particular blog entry, the page title of the entire Panel changes.
This Panel is NOT my frontpage, it's just a Panel-based page at a URL. It happens to be the LAST blog posting in that view on the Panel, which makes me wonder if that's a clue to unexpected behavior.
The minute I put my mod in place of phptemplate_variable, the problem goes away. But this is a clumsy workaround. It doesn't do anything to fix the problem in Page Title, it just blocks Page Title from being invoked on this Panel page.
If no one has reported this, perhaps they don't have my mix of views/nodes on a Panel page?
I'll try 2.0 alpha 5....
Comment #14
hawkdrupal commentedI just switched to 2.0 alpha 5 as you suggested. It immediately fixed the problem I reported.
However, I can't get any tokens to work for frontpage. Whether I use your default tokens or type in others, whatever I put in "Frontpage Pattern" shows as literal text -- I see the actual tokens code in the browser's page title bar. So, for now I put in appropriate literal text, but you might want to check on why that particular Page Type doesn't work as expected.
Comment #15
nicholasthompsonWith regard to the problem in 1.1, it sounds like your view (or something) is invoking hook_nodeapi with a node as a PAGE view rather than an individual. Where this is happening, I dont know - but that is the ONLY way the last node in your list would be overriding the Panel title. Have you overridden the view with your own code?
Thats odd about the frontpage tokens not working... I'm sure I've used them on other sites! I shall investiage this for you. Thanks for brining this up.
Comment #16
nicholasthompsonI've tested the frontpage tokens on ALPHA6 (and 5)... They worked fine for me. What tokens were you using?
Comment #17
nicholasthompsonMarking as fixed... I cannot replicated and there has been no further reports of this or any similar problem.
Comment #18
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.