Jump to content

[Solved] Smarty how to write <if this page = index.php> etc? ...


Recommended Posts

Hi,

I'm still constantly puzzled with this OOPHP and SMARTY!
It's really frustrating considering I have a pretty decent knowledge of standard PHP!

Anyway, could somebody tell me the syntax/code for this simple conditional?
I need to know how to write in SMARTY "if this page = index.php" or "if this page = product.php" etc..

So I can display certain things on certain pages.

I know it is simple but I can't work it out :-S

Thanks

Link to comment
Share on other sites

Hi, for exemple, no left column displayed on homepage:

{if $page_name != 'index'}

                   {$HOOK_LEFT_COLUMN}

       {/if}



Another exemple, right column only displayed on product page:

{if $page_name == 'product'}

                   {$HOOK_RIGHT_COLUMN}

       {/if}

Link to comment
Share on other sites

  • 1 month later...

i have also used this to remove left hook works fine but i have more need from it, it removes left hook on home page but i want it to remove it from cms pages aswell.

i tried

{if $page_name != 'index or cms'}


{$HOOK_LEFT_COLUMN}

{/if}

but that does not seem to work.
Link to comment
Share on other sites

yeah its called cms, when i used
{if $page_name != ‘index` && $page_name != `cms’} it showed the left hook on the home page again that it didnt before
i have also tried {if $page_name != ‘index` OR $page_name != `cms’} that dosnt work either

Link to comment
Share on other sites

  • 3 months later...
  • 8 years later...

This is an old post. But I had a simular problem in PS 1.7.6.5. And since the info here didn't work for me, I'll post what worked for me:

{if $page.page_name != 'index'}
...
{/if}

Basicly, the only thing that changed is $page_name is now  replaced by $page.page_name.

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...