Page 1 of 1

if page alias is not working

Posted: Wed Apr 17, 2019 8:45 pm
by jollyoner3
Hi guys, trying to use a javascript on certain pages, inserted into the "head" template file which is used on every page.

I tried :

Code: Select all

{if $page_alias = 'about-us'}
But it posts to every page regardless, am i missing something?

Re: if page alias is not working

Posted: Wed Apr 17, 2019 9:01 pm
by calguy1000

Code: Select all

{if $page_alias == 'about-us'}
WOOT
{/if}
== is a comparison operator = is an assignment operator.

Re: if page alias is not working

Posted: Wed Apr 17, 2019 9:27 pm
by jollyoner3
Thankyou very much for the reply!

It works when i use single alias, how would i do something like this :

Code: Select all

{if $page_alias == 'about-us, home, contact-us'}

Re: if page alias is not working

Posted: Wed Apr 17, 2019 9:53 pm
by MantaPro

Code: Select all

{if $page_alias == 'about-us' || $page_alias == 'home || $page_alias == 'contact-us'}
https://www.smarty.net/docs/en/language.function.if.tpl

[SOLVED]Re: if page alias is not working

Posted: Wed Apr 17, 2019 9:53 pm
by jollyoner3
Thankyou! :) Sorted it