If Then Statements with V3 / Smarty

Discussion in 'Templates customization' started by bgtheory, May 14, 2012.

  1. bgtheory

    bgtheory New Member

    Joined:
    Jan 22, 2010
    Messages:
    15
    Hi, I am almost positive I remember seeing a thread that had outlined how to do if/then statements with smarty tags, but for the life of me I cannot find it. Essentially, what I want am trying to do is customize my sidebar area so that different messaging displays based on their active product ID and whether or not they are logged in.

    User not logged in - display content A
    User logged in with product #1 or 2 or 3 - display content B
    User logged in with product # 3 or 4 or 5 - display content C

    We use wordpress and pages are PHP.

    Any help is appreciated!
  2. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,435
    For smarty:
    {foreach from=$products item=p}
    {if $p.product_id eq "1"}
    do this
    {else}
    do other
    {/if}
    {/foreach}

    But you are asking about PHP? Unclear.

    David
  3. davidm1

    davidm1 aMember User & Partner

    Joined:
    May 16, 2006
    Messages:
    4,435
  4. bgtheory

    bgtheory New Member

    Joined:
    Jan 22, 2010
    Messages:
    15
    David, thanks for the fast replies, I got it to work! We are using the amProtect plugin, not sure why I didn't think of it before!

Share This Page