CMSMS (since 1.5 IIRC) performs template processing in a non-standard manner.
Given a simplified page template like:
Code: Select all
<__html>
<head>
{metadata}
</head>
</__body>
{content}
<__body>
</__html>
1. Anything above is processed
2. The body is processed
3. The head section is processed
4. all of the information from the above 3 steps is glued back together and output.
This is done to allow setting variables in the body (i.e:from a module) that can then be used in the head (to do things like set page title etc).
i.e (another simplified example):
Code: Select all
<__html>
<head>
<title>{$mypagetitle}</title>
{metadata}
</head>
</__body>
{content block='mypagetitle' oneline=true assign='mypagetitle'}
{content}
<__body>
</__html>
Notice how 'mypagetitle' is created in the body, and then used in the head section.
Alternatively
Code: Select all
{content block='mypagetitle' oneline=true assign='mypagetitle'}
<__html>
<head>
[color=green]<title>{$mypagetitle}</title>[/color]
{metadata}
</head>
</__body>
[color=green]<h3>{$mypagetitle}</h3>[/color]
{content}
<__body>
</__html>
Notice how mypagetitle is created above the head section, and then used in both the head and the body.
However: This will not work:
Code: Select all
<__html>
<head>
{content block='mypagetitle' oneline=true assign='mypagetitle'}
<title>{$mypagetitle}</title>
{metadata}
</head>
</__body>
<h3>{$mypagetitle}</h3>
{content}
<__body>
</__html>
This is because the body is processed first, and the head section is processed afterwards, therefore {$mypagetitle} is not set until the head is processed.
Of course in these simplified examples I am not doing any error checking to make sure that somebody actually specified a string in the mypagetitle field in edit content.
This is useful for things like:
a) setting the canonical URL from the news detail page
b) setting the page title from a news detail page
or any other header variable that you want to set.
Hope this solves the issue once and for all.