Re[2]: [SMARTY] switch instruction in smarty?

pbaker <[email protected]>
Newsgroups gmane.comp.php.smarty.general
Message-ID <[email protected]>
Hi,
thank U but this not solve my problem,
this is a sample of my code (tab menu on top of my page):

[code]

{assign var="tab" value=$smarty.get.cmd}
<table border="0" cellpadding="0" cellspacing="0"  height="20" class="tabmain">
<tr>
{if $tab eq "main" || $tab eq ""}
        <td align="center" nowrap bgcolor="#FFDF54"><span
        class="mm">Main</span></td>
{else}
        <td align="center" nowrap bgcolor="#F4F5F6"><a
        href="{$SCRIPT_NAME}?cmd=main" class="mm">Main</a></td>
{/if}

{if $tab eq "last"}
        <td align="center" nowrap bgcolor="#FFDF54"><span
        class="mm">Last</span></td>
{else}
        <td align="center" nowrap bgcolor="#F4F5F6"><a
        href="{$SCRIPT_NAME}?cmd=last" class="mm">Last</a></td>
{/if}

[/code]

if user type '?cmd=qwerty' i want to display the default value (first
if)




________________________________________________________________________
> Hi,

> I think you have to take a look at the {else} and {elseif} functions:

> http://smarty.php.net/manual/en/language.function.if.php

> {if $foo eq "something"}
>   <tr><td>show a</td></tr>
> {elseif $foo eq "blablabla"}
>   <tr><td>shob b</td><tr>
> {else}
>   <tr><td>default value</td></tr>
> {/if}

> Does this solve your problem?

> pbaker wrote:

>>Hi,
>>i have a problem with my templates.
>>this is some template...
>>
>>[code]
>>
>>{assign var="foo" value=$smarty.get.bar}
>>
>>{if $foo eq "something"}
>> <tr><td>show my webpage</td></tr>
>>{/if}
>>
>>{if $foo eq "somethingelse"}
>> <tr><td>show another page</td></tr>
>>{/if}
>>
>>.....
>>.....
>>
>>[/code]
>>
>>everything is ok when the foo variable eq the $smarty.get.bar
>>
>>but i want to display the default value... !
>>
>>i want to do in smarty something like switch instruction in php...
>>
>>any suggestion?
>>
>>
>>ps.: sorry 4 my english :P
>>
>>  
>>

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.