You are here: Re[2]: [SMARTY] switch instruction in smarty? « Smarty Templates Posts « IT news, forums, messages
Re[2]: [SMARTY] switch instruction in smarty?

Posted by pbaker on 10/21/05 17:20

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
>>
>>
>>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация