[support] page titles for views?

Bill Fitzgerald bill at funnymonkey.com
Mon Oct 1 23:18:05 UTC 2007


I don't know if this would work, as I haven't tried this yet, so, take 
this for what it's worth.

Which ain't much...

How about a function in template.php that would grab a title generated 
from some php in the view header?

This way, it would Just Work in any view, and you wouldn't need to 
hardcode anything --

Cheers,

Bill

sander-martijn wrote:
> Anyone have an idea how to do this? I still haven't figured it out.
>
> thanks
> .sander
>
> sander-martijn wrote:
>   
>> Does anyone know a way to customize the page title (in the title tag) 
>> for a view?  I asked about this for pages earlier and Bill suggested
>> the page title module which works great - but there are two top level 
>> pages that are views that I need to customize the titles for and the 
>> page title module doesn't work with views.  Since it's only two pages 
>> and the title isn't likely to change or at least not often I'm even 
>> willing to hard code it into template.php. what i tried so far is to add 
>> the following function to _phptemplate_variables:
>>
>> if($vars['node']->nid == '12'){
>>   $vars['head_title'] = "TEST";
>> }
>>
>>
>> I verified (through print statements) that the statement gets triggered 
>> on the proper page and that $vars['head_title'] is printing the current 
>> title.  Furthermore a similar function is how the page title module does 
>> it.  Yet when I print out the variable immediately after the function it 
>> still stays what it was.  Full with print statements and output:
>>
>> print($vars['head_title']); // prints: Photo Gallery | Timberpeg
>> if($vars['node']->nid == '12'){
>>   print(" changing to test "); // prints: changing to test - indicates 
>> it gets triggered
>>   $vars['head_title'] = "TEST";
>> }
>> print($vars['head_title']); // prints: Photo Gallery | Timberpeg
>>
>> thanks
>> .sander
>>     


-- 
Bill Fitzgerald
http://www.funnymonkey.com
Tools for Teachers
503.897.7160



More information about the support mailing list