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 to set array calling function plugin

 
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
mstdmstd
Smarty Rookie


Joined: 04 Jan 2013
Posts: 20

PostPosted: Sun Sep 22, 2013 6:52 am    Post subject: How to set array calling function plugin Reply with quote

Hi,
If I can to set array calling function plugin like :
Code:
  {assign var=var_name value=array( 'bar'=>'baz', 'bar2'=>'blah' ) }
...
  {url_parameter foo = $var_name }

or

Code:
  {url_parameter foo = array( 'bar'=>'baz', 'bar2'=>'blah' ) }

where url_peremeter is function plugin ?
I tried and recieved syntax error ...
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sun Sep 22, 2013 8:47 am    Post subject: Reply with quote

All pluging parameter passed in one array $params where the arttribute name is the array index. In your case $params['foo']
Back to top
View user's profile Send private message
mstdmstd
Smarty Rookie


Joined: 04 Jan 2013
Posts: 20

PostPosted: Sun Sep 22, 2013 9:46 am    Post subject: Reply with quote

Sorry, seems my question was not clear. I mean that the problem is in smarty template, I want to know valid syntax for array passed to plugin.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sun Sep 22, 2013 2:55 pm    Post subject: Reply with quote

Sorry I did not see that. Smarty's syntax for arrays is [...]. So the right syntax is
Code:
{url_parameter foo = ['bar'=>'baz', 'bar2'=>'blah'] }
Back to top
View user's profile Send private message
mstdmstd
Smarty Rookie


Joined: 04 Jan 2013
Posts: 20

PostPosted: Mon Sep 23, 2013 4:26 am    Post subject: Reply with quote

Thanks!
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 -> 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