Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Assign value to a template variable's index

 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
marcel158
Smarty n00b


Joined: 22 Sep 2015
Posts: 1

PostPosted: Tue Sep 22, 2015 9:45 pm    Post subject: Assign value to a template variable's index Reply with quote

Hello forum members,

Is there a way to assign values to a template variable's index, like:

$smarty->assign->('myarray.index', $value);
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1518

PostPosted: Wed Sep 23, 2015 5:00 am    Post subject: Reply with quote

You're asking wrong question.
Prepare ENTIRE array in your application, then assign it normally.
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Thu Sep 24, 2015 7:09 pm    Post subject: Reply with quote

Code:
$smarty->assign('myarray', array('index' => $value);

But you can't append other index values. so prepare your array in PHP and then assign it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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