Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

extending vars

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
holunda
Smarty Rookie


Joined: 27 Jun 2003
Posts: 28
Location: Austria > Tyrol

PostPosted: Wed Sep 24, 2003 11:05 am    Post subject: extending vars Reply with quote

Hi @all

I am trying to do this thing in Smarty:

[php:1:c4fcc7a53e]
$var . $var2
[/php:1:c4fcc7a53e]

I've tried this but it didnt work:

{$smarty.post.var_{$var2}}

I think it's a little problem but at the moment i am not able to solve it ...
Please help me ...

Alex
Back to top
View user's profile Send private message
andre
Smarty Pro


Joined: 23 Apr 2003
Posts: 164
Location: Karlsruhe, Germany

PostPosted: Wed Sep 24, 2003 11:09 am    Post subject: Reply with quote

Two possibilities:

For using as parameter of plugin function calls you can do something like this:
Code:
{foo bar="`$var1` `$var2`"}

(notice the backticks !)

Alternatively you can use the "cat" modifier:
Code:
{$var1|cat:" "|cat:$var2}
{foo bar=$var1|cat:" "|cat:$var2}
Back to top
View user's profile Send private message
holunda
Smarty Rookie


Joined: 27 Jun 2003
Posts: 28
Location: Austria > Tyrol

PostPosted: Wed Sep 24, 2003 11:25 am    Post subject: Reply with quote

hmm thank you for your reply,

i think i have to post a little bit more code:
[php:1:ee06bf2319]
<table>
{section name=row loop=$verkauf}
<tr>
<td>{$verkauf[row].bezeichnung}:</td>
<td class="width40"><input type="text" size="2" name="verkauf_{$verkauf[row].aktion_id}" value="" /></td>
</tr>
{sectionelse}
<tr>
<td>Keine Aktionen gefunden</td>
</tr>
{/section}
[/php:1:ee06bf2319]

As value of the dynamic input field should stand itselfs $_POST value.
Do you understand my problem?

thx, ALex
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed Sep 24, 2003 1:04 pm    Post subject: Reply with quote

you'll need an intermediate value to access your values:
{assign var=verkauf_aktion_id value="verkauf_`$verkauf[row].aktion_id`"}
{$smarty.post.verkauf_aktion_id}


but i'd post the variables as an array:
... name="verkauf[{$verkauf[row].aktion_id}]" ...

and access them accordingly (unfortunately you need an intermediate value here, too, but arrays are much more handy than lists of variable variable):

{assign var=aktion_id value=$verkauf[row].aktion_id}
{$smarty.post.verkauf.$aktion_id}
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP