|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
kama Smarty n00b
Joined: 14 Jul 2003 Posts: 4
|
Posted: Mon Jul 14, 2003 7:31 pm Post subject: Improvement in using Smarty Variables in Templates |
|
|
I suggest the possiblity to use things like in PHP are available:
e.g.
<select name="{$sb_name}">
...
{if $$sb_name == {item.ID}
^^^
That could be very helpfull...
This will give the oportunity to create include files which handle complete
drop-down boxes independed of any variable or context which can completley defined if you include it:
{include file="sb_test" sb_name="iWorkers" aList=$aWorkers} |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Mon Jul 14, 2003 9:31 pm Post subject: |
|
|
Kama, I tried to evaluate your suggestion but didn't get very far. Could you can give a more specific and detailed example? Already, much PHP functionality is either directly available or simulated in Smarty. Further, your request seems to imply indirect variable usage but your example does not pertain to that. In fact, I'm sure its me, but I am having a hard time understanding your example.
Thanks! |
|
Back to top |
|
kama Smarty n00b
Joined: 14 Jul 2003 Posts: 4
|
Posted: Wed Jul 16, 2003 6:54 pm Post subject: |
|
|
boots wrote: | Kama, I tried to evaluate your suggestion but didn't get very far. Could you can give a more specific and detailed example? Already, much PHP functionality is either directly available or simulated in Smarty. Further, your request seems to imply indirect variable usage but your example does not pertain to that. In fact, I'm sure its me, but I am having a hard time understanding your example.
Thanks! |
I'm sorry that you don't get very far....here you get a more complete example:
Ok i have much Template files which use select-boxes for e.g. for a list with employees. The file i created comprises of the following code:
<select name="{$sb_name}">
{foreach item=item from=$aListe}
{if $sb_name == $item.ID}
<option value="{$item.ID}" selected="selected">{$item.Name}, {$item.Vorname}</option>
{else}
<option value="{$item.ID}">{$item.Name}, {$item.Vorname}</option>
{/if}
{/foreach}
</select>
If i include the above file into an other template like this:
{include file="sb_employee.tpl" sb_name="iWork" aListe=aEmployee}
I will use the include file in that way that i can give the name of the
select-box using {$sb_name} but also i will use this name to transfer
the index to the template if an entry had been selected.
This will result in the usage i suggested:
So i tried to change the code above into:
{if $$sb_name == $item.ID}
but this won't work....this was the reason for asking in this forum...
I hope this will be more clear than the example before...
Kind regards...
Karl Heinz |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|