Different Signup Forms For Different Price Groups

Discussion in 'Templates customization' started by jason_jo1, Sep 1, 2008.

  1. jason_jo1

    jason_jo1 New Member

    Joined:
    Aug 22, 2006
    Messages:
    1
    Hi there,

    I'm trying to edit my signup.html form so that if people come to it from price group -1 they are shown one header graphic, and if they come to it from any other they are not shown a header graphic.

    This is the code I've got and I can't seem to get it to work properly

    {if ($vars['price_group'] == -1)
    <img src="graphic_file.jpg" width="216" height="139" alt="alt tag" />
    else
    &nbsp;
    }

    Can anyone advise please on how to get this working?

    Thanks for your help

    Jason
  2. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    Are you getting an error of some kind (on screen or in error log) or is it just not working for you?

    At quick glance and issue may be that, as you are working with Smarty, you have to structure it a bit different.

    example from the smarty reference guide

    Code:
    {if $name eq 'Fred'}
        Welcome Sir.
    {elseif $name eq 'Wilma'}
        Welcome Ma'am.
    {else}
        Welcome, whatever you are.
    {/if}
    so that would translate to something like:

    Code:
    {if ($vars['price_group'] eq -1)}
    <img src="graphic_file.jpg" width="216" height="139" alt="alt tag" />
    {else}
    &nbsp;
    {/if}
    I haven't tested that so you may need to do some tinkering with it.
  3. jbround39

    jbround39 aMember Pro Customer

    Joined:
    Mar 20, 2008
    Messages:
    61
    Skippy's code looks fine, I think the missing curly brackets were the problem. But I always had issues with the smarty code, so I started avoiding it entirely.

    Now, I just put all my php inside the {php} {/php} smarty tags, and that does it.

    So another option would be to just write typical php code inside the smarty php tags and echo your img the normal way, ignoring the weird smarty tags entirely.
  4. jimjwright

    jimjwright New Member

    Joined:
    Sep 12, 2007
    Messages:
    162
    Hello,

    How about the following:

    PHP:
    {if $smarty.request.price_group == -1}
    <
    img src="graphic_file.jpg" width="216" height="139" alt="alt tag" />
    {else}
    &
    nbsp;
    {/if}
    Jimmy
  5. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    I think that jbround39 wins the cigar on this one... wrap it in php tags and code it normal.
  6. jimjwright

    jimjwright New Member

    Joined:
    Sep 12, 2007
    Messages:
    162
    Hello,

    My only reason for responding is that I didn't think $vars['price_group'] would work from the smarty template. I thought you would have to use $smarty.request.price_group instead. But I'm no expert on Smarty.

    Jimmy
  7. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    Jimmy, you are probably right.. I haven't touched that side of things for some time (hence the disclaimer :-p)

Share This Page