Changing the CMS made Simple output page titles

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
jeff1234
New Member
New Member
Posts: 4
Joined: Wed Nov 12, 2008 12:40 am

Changing the CMS made Simple output page titles

Post by jeff1234 »

Hi,
I've been stumped on this for awhile, and figured I'd see if there is an easy way to do this.

I want to change the page title from a php script included in the body of the cms.

So far, I have been even unable to change the page title with smarty tags alone:

For example:
in the body of a page I have:
{assign var='newtitle' value='New Title!!!!"}

and then in the template I put {$newtitle} where I want it:
{$newtitle}
doesn't work there!

but it does when it is BELOW the body text:
{$newtitle}

So how to do this simply through a php script I've included in the body text?
alby

Re: Changing the CMS made Simple output page titles

Post by alby »

jeff1234 wrote: and then in the template I put {$newtitle} where I want it:
{$newtitle}
doesn't work there!
Have you tried (in config.php) with:
$config['process_whole_template'] = false;

Alby
jeff1234
New Member
New Member
Posts: 4
Joined: Wed Nov 12, 2008 12:40 am

Re: Changing the CMS made Simple output page titles

Post by jeff1234 »

Yes, I've played with this. It doesn't seem to change what is going on.

I have discovered something new, however:

$config['process_whole_template'] = true;

Is how I have it set in the config.

If I write the following in the template:
{assign var=newtitle value='Very New Title!!!'}
{$newtitle}

It seems to make a new title.

If I write this in the body text:
{assign var=newtitle value='Very New Title!!!'}

And this in the template:
{$newtitle}

and this in the body text:
{$newtitle}

Then the newtitle is output in the body text but not the template.


So I have to somehow dynamically generate the new Title in the template. I'd like to use PHP to do this. {php} {/php} tags don't seem to work....I'll try to include....
jeff1234
New Member
New Member
Posts: 4
Joined: Wed Nov 12, 2008 12:40 am

Re: Changing the CMS made Simple output page titles

Post by jeff1234 »

There seem to be three states here for process_whole_template

$config['process_whole_template'] = false;
$config['process_whole_template'] = true;

and then uncommented:
# $config['process_whole_template'] = true;

The false renders a website without any formatting. Unusual behavior.

the uncommented and commented has no affect that I can tell on the behavior I am trying to understand here with the assigning of variables with smarty tags and then the use of variables with smarty tags in the body text and the template.
jeff1234
New Member
New Member
Posts: 4
Joined: Wed Nov 12, 2008 12:40 am

Re: Changing the CMS made Simple output page titles

Post by jeff1234 »

Solution. I have resolved this. Though there must be a better way to do it.
Some things I've discovered:

As far as smarty tags are concerned, the order of where the tags are in relation to each other is important! If you assign a variable in the head of the template like this:

{assign var="newtitle" value="New Title!"}
Then when you use the smarty tag {$newtitle} in the body of the page (entered through the cms) the we are good to go.

However Beware! if you assign the variable in the body of the page, then it is meaningless in the html from the template above the body text. In otherwords, don't expect to define $newtitle in the body like this:
{include_php file="/home/website/httpdocs/includes/test.php" assign='newtitle'}

and then in the template do this: {$newtitle}

$newtitle is meaningless at this point: smarty has yet to define it.

So the solution is to put the definition of the newtitle in the template above its usage:

{include_php file="/home/website/httpdocs/includes/test.php" assign='newtitle'}
{$newtitle}

ands then just have the php script figure out what you'd like to call your page.
Post Reply

Return to “Developers Discussion”