[solved]Add tags 2 template for specific pages/exclude pages

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
ladyr0gue
Forum Members
Forum Members
Posts: 91
Joined: Fri Feb 17, 2012 4:25 pm

Re: Add tags to template for specific pages/ exclude pages

Post by ladyr0gue »

[quote="Dr.CSS"]Sorry...

{if $page_alias == 'news'}

top job that's the one! Knew we'd get there in the end ;) thank yoooooou :)

edit: it does still return a 'some content' block on every page - though I guess it's not a biggie - now using

Code: Select all

{if $page_alias == 'news'}
{content block='some content'}
{else}
{news number="1"}
{/if}
ladyr0gue
Forum Members
Forum Members
Posts: 91
Joined: Fri Feb 17, 2012 4:25 pm

Re: Add tags to template for specific pages/ exclude pages

Post by ladyr0gue »

You know it has just occured to me that I really don't need that 'some content' block at all - as I have a content block below news which fills the same space if news doesn't exist. What ideally I would to say is: if pagealias =="news", do nothing, else call {news}. Is that possible
?? sorry for being difficult :/
ladyr0gue
Forum Members
Forum Members
Posts: 91
Joined: Fri Feb 17, 2012 4:25 pm

Re: Add tags to template for specific pages/ exclude pages

Post by ladyr0gue »

Woot Woot! Just managed to find through trial and error that this seems to do what I am trying to achieve...

{if $page_alias == 'news'}
{*}
{else}
{news number="1"}
{/if}

is that the correct way of doing it? if page=news do nothing and else show news summary?
mcDavid
Power Poster
Power Poster
Posts: 377
Joined: Tue Mar 31, 2009 8:45 pm

Re: Add tags to template for specific pages/ exclude pages

Post by mcDavid »

It's correct but you can be shorter:

Code: Select all

{if $page_alias !== 'news'}
  {news number=1}
{/if}
the ! means: NOT
ladyr0gue
Forum Members
Forum Members
Posts: 91
Joined: Fri Feb 17, 2012 4:25 pm

Re: Add tags to template for specific pages/ exclude pages

Post by ladyr0gue »

mcDavid wrote:It's correct but you can be shorter:

Code: Select all

{if $page_alias !== 'news'}
  {news number=1}
{/if}
the ! means: NOT

thank you :)
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1973
Joined: Mon Jan 29, 2007 4:47 pm

Re: Add tags to template for specific pages/ exclude pages

Post by Jo Morg »

Dr.CSS wrote:Sorry...

{if $page_alias == 'news'}

http://www.smarty.net/docsv2/en/languag ... ion.if.tpl
Oppsy!!!! I should have caught that error before... sorry! Been busy and running from one place to another.

If I had been more careful in answering, this thread would probably be a lot shorter... :-\
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
ladyr0gue
Forum Members
Forum Members
Posts: 91
Joined: Fri Feb 17, 2012 4:25 pm

Re: Add tags to template for specific pages/ exclude pages

Post by ladyr0gue »

no worries, thanks anyway, you helped me pass the time while I was waiting hehe ;)
Post Reply

Return to “CMSMS Core”