Smarty question

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Locked
ahmednuaman

Smarty question

Post by ahmednuaman »

I'd like to check if the title of a page is something, for example if title is 'home'.

Is this the correct smarty syntax:

Code: Select all

{if title eq 'home'}<div></div>{/if}
cyberman

Re: Smarty question

Post by cyberman »

You can check with {get_template_vars} inside your content if $title is available ;) ...
ahmednuaman

Re: Smarty question

Post by ahmednuaman »

But {title} is a system tag; it's always available. How can I query if it's a certain word or not?
cyberman

Re: Smarty question

Post by cyberman »

Yes, title is a tag but it's only like a included php file - it returns the value of title. It's not assigned to Smarty.

But you can do it ;)

http://www.smarty.net/manual/en/languag ... on.capture

So you have to insert to your template

Code: Select all

{capture name='checktitle'}{title}{/capture}
{if $checktitle eq 'home'}<div></div>{/if}
Last edited by cyberman on Thu Jun 05, 2008 6:17 am, edited 1 time in total.
ahmednuaman

Re: Smarty question

Post by ahmednuaman »

Cool thanks
Locked

Return to “Layout and Design (CSS & HTML)”