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

How can I do this assignment

 
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 -> Smarty Development
View previous topic :: View next topic  
Author Message
tolleiv
Smarty n00b


Joined: 27 Oct 2004
Posts: 2

PostPosted: Wed Oct 27, 2004 10:13 am    Post subject: How can I do this assignment Reply with quote

Hi

how can I do this :
// the assignment is the problem and I can't find a solution Wink

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
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Wed Oct 27, 2004 1:41 pm    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
tolleiv
Smarty n00b


Joined: 27 Oct 2004
Posts: 2

PostPosted: Thu Oct 28, 2004 12:49 pm    Post subject: Reply with quote

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 Wink or has some improvements Cool
thx
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu Oct 28, 2004 2:15 pm    Post subject: Reply with quote

Okay, I'll search for you:

http://www.phpinsider.com/smarty-forum/viewtopic.php?p=14848&highlight=#14848
Back to top
View user's profile Send private message
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 -> Smarty Development 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