Page 1 of 1

Dynamic Page Titles

Posted: Thu Dec 03, 2009 11:26 pm
by tripp
Hi Everybody,

I'm trying to figure out how to dynamically change the title of my page from inside a custom module that I've written. Is there anyway from within a module "action" file that I can specify the title of the page? I can't find any info on this here, but I'm sure that someone else has had this issue. Any ideas?

Cheers,

Tripp

Re: Dynamic Page Titles

Posted: Thu Dec 03, 2009 11:51 pm
by Peciura
In your php code add

Code: Select all

global $gCms;
$smarty = $gCms->GetSmarty();
$smarty->assign('title_temp', "$custom_title_you_prefer");
In page template replace tag "{title}" with

Code: Select all

{if !empty($title_temp)}
   {$title_temp}
   {assign var='title_temp' value=''}{*optional line*}
{else}
   {title}
{/if}

Re: Dynamic Page Titles

Posted: Fri Dec 04, 2009 6:41 pm
by tripp
Thanks mate, just what I needed. My apologies to the moderators for putting this in the wrong forum. No real excuse for that, I just wasn't paying attention.

Cheers,

Tripp