Dynamic Page Title for a Module?

dan
dan's picture
Joined: 04/16/2007
User offline. Last seen 3 years 28 weeks ago.

I ended up creating a module to solve my last problem.
Everything is working well, except I can't figure out how to do one thing.

I would like the page title (in the HTML head) to be decided by the dynamic content of the page. I can't figure out how to do this, as it seems that this is fixed in stone by the title value set in the items array in the hook_menu function at the time the module is activated. However, I know this dynamic titling is possible, because other modules (specifically the forum module) do it.

Any help would be greatly appreciated.

I like cheese.

G&G Podcast Host
Matt Farina's picture
Joined: 06/01/2006
User offline. Last seen 21 weeks 6 days ago.
drupal_set_title

The page title is usually the title as set in hook_menu. If you want to change it after the fact use the function drupal_set_title(). This is what the forum modules does.

http://api.drupal.org/api/function/drupal_set_title/5

Matt Farina
Geeks and God Co-Host
www.innovatingtomorrow.net
www.mattfarina.com

Matt Farina
Geeks and God Former Co-Host
www.mattfarina.com

dan
dan's picture
Joined: 04/16/2007
User offline. Last seen 3 years 28 weeks ago.
Thanks!

You da man!

I still need to get a whole lot more familiar with the APIs.

I like cheese.