Using "or" with smarty

Discussion in 'PHP' started by tmeyer45458, Mar 14, 2007.

  1. #1
    I'm attempting to use "or" within a smarty tag but can't seem to make it work. Each time I use the code in bold font, "foo" shows on everypage. Now, if I omit ["this-page" or "that-page"] then "foo" shows on the about page and "foobar" shows on the dealers page. My code is as follows:

    {if $page eq "about-us" or "this-page" or "that-page"}
    <p>foo</p>
    {elseif $page eq "dealers"}
    <p>foobar</p>
    {else}
    <p>Catch all content</p>
    {/if}

    How do I "group" pages together using the "or" operator...or any other method for that matter?

    I'm simply trying to make it possible to show different content in the sidebar for different pages. For the most part all is working, but when I try to show the same content on more than one page I run into issues.

    Thanks in advance for the help!

    Tim
     
    tmeyer45458, Mar 14, 2007 IP
  2. JoshuaGross

    JoshuaGross Peon

    Messages:
    411
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #2
    {if $page eq "about-us" or $page eq "this-page" or $page eq "that-page"}

    I've never used Smarty but that would sense from a programmer's point of view.
     
    JoshuaGross, Mar 14, 2007 IP
  3. tmeyer45458

    tmeyer45458 Peon

    Messages:
    355
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks...worked great!
     
    tmeyer45458, Mar 14, 2007 IP