Custom variables
Posted: Tue Feb 20, 2007 11:53 am
Hi,
I'm new to the forum. I've just started using CMSMS so no doubt I'll have a few questions over the coming weeks and months!
What I would like to be able to do is assign custom variables to specific pages. For example, I want to highlight a particular menu item when you're on any of the sub-pages within that section of the site. Of course, I can do this by putting some php in my template that checks the alias of all the pages in the section and sets a css class, eg.
But it would be much neater to just say:
Is there any way of doing this, or something similar? Potentially there could be a need to assign several custom variables to a page - other uses would be to pull in page-specific stylesheets or scripts, etc.
Sorry if I'm being thick and there's already a way to do this!
Matt
I'm new to the forum. I've just started using CMSMS so no doubt I'll have a few questions over the coming weeks and months!
What I would like to be able to do is assign custom variables to specific pages. For example, I want to highlight a particular menu item when you're on any of the sub-pages within that section of the site. Of course, I can do this by putting some php in my template that checks the alias of all the pages in the section and sets a css class, eg.
Code: Select all
if ($alias == 'about-us' || $alias == 'contact-us' || $alias == 'recruitment' etc.etc.etc.) {
echo 'class="highlight"';
}
Code: Select all
if ($custom_variable == 'bob') {
echo 'class="highlight"';
}
Sorry if I'm being thick and there's already a way to do this!
Matt