|
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 |
tolleiv Smarty n00b
Joined: 27 Oct 2004 Posts: 2
|
Posted: Wed Oct 27, 2004 10:13 am Post subject: How can I do this assignment |
|
|
Hi
how can I do this :
// the assignment is the problem and I can't find a solution
Code: |
{section name=bar loop=$foo}
{capture name=src}<img src="foobar.gif" />{/capture}
{assign var=$foo[bar].picsrc value=$smarty.capture.src}
{/section}
|
thx |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Wed Oct 27, 2004 1:41 pm Post subject: |
|
|
Smarty doesn't provide a facility to assign to elements of an array. Please search the forum for ideas -- this was answered as recently as this week |
|
Back to top |
|
tolleiv Smarty n00b
Joined: 27 Oct 2004 Posts: 2
|
Posted: Thu Oct 28, 2004 12:49 pm Post subject: |
|
|
hmpf thx
the solution i found :
Code: |
{section name=bar loop=$foo}
{capture name='src'|cat:$foo[bar].id}<img src="foobar.gif" />{/capture}
{/section}
|
to access the safed value i use :
Code: |
{assign var=tmp value='src'|cat:$foo.0.id}{$smarty.capture.$tmp}
|
maybe someone else can use it or has some improvements
thx |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
|
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
|