| Pete M 2004-05-11, 11:52 am |
| oops typo - else if is an undeleted image - same problem though
{elseif $ntabs[t].site_type_id != $site_type_id }
<td width="{$tab_width}" align="center"
background="images/UNselected.jpg">{$ntabs[t].site_type}</td>
Pete M wrote:
> dont' know how to explain properly so here I go ;-)
>
> I've got a set of tabs across the top of a page from this array
>
> print_r()
> $site_types = Array (
> [0] => Array ( [site_type_id] => 1 [site_type] => Branches )
> [1] => Array ( [site_type_id] => 2 [site_type] => Clients )
> [2] => Array ( [site_type_id] => 3 [site_type] => Misc )
> [3] => Array ( [site_type_id] => 0 [site_type] => All )
> [4] => Array ( [site_type_id] => new [site_type] => New Site ) )
> [5] => Array ( [site_type_id] => index [site_type] => Sites Index )
> )
>
> then the following statments
>
> // set default
> $site_type_id = ($_GET['site_type_id'] != '')? $_GET['site_type_id'] : 0;
> $smarty->assign_by_ref('site_type_id', $site_type_id);
>
> // site tabs
> $smarty->assign_by_ref('ntabs',$site_types);
>
> and a snippet of the template
> <table><tr>
>
> {if $ntabs[t].site_type_id == $site_type_id }
> <td width="{$tab_width}" align="center"
> background="images/selected.jpg">{$ntabs[t].site_type}</td>
>
> {elseif $ntabs[t].site_type_id != $site_type_id }
> <td width="{$tab_width}" align="center"
> background="images/selected.jpg">{$ntabs[t].site_type}</td>
>
> {/if}
> </tr></table>
>
>
> Now what happens is that when the default is set above to 0
> the "New Site" and "Sites Index" are also selected
>
> However setting the default to "0" makes it work ok ?
>
> where is the "companison" type casting - in php or smarty ??
>
> pete
|