|
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 |
czarnowski Guest
|
Posted: Thu Jan 17, 2008 11:45 am Post subject: |
|
|
To assign an array with this values
"one", "two", "three"
you can do this:
{assign var='myarray' value=','|explode:"one,two,three"} |
|
Back to top |
|
cjxxi Smarty Regular
Joined: 03 Aug 2007 Posts: 40 Location: Fort Worth,Texas
|
Posted: Sun Sep 14, 2008 9:07 am Post subject: |
|
|
Check out this plugin, which allows you to create an associate or non-associate array with smarty
http://www.phpinsider.com/smarty-forum/viewtopic.php?t=14132
... In response to the original post, this would go something like this... (if using the plugin)
Code: |
{array vars='array("one", "two", "three")' assign='arg'}
{include file="Foo.tpl" arg=$arg}
|
_________________ CJAX THE PHP AJAX FRAMEWORK AT CJAX.NET |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Tue Mar 20, 2012 3:10 pm Post subject: |
|
|
You can define arrays within templates.
Examples:
{assign var=foo value=[1,2,3]}
{assign var=foo value=['y'=>'yellow','b'=>'blue']}
Arrays can be nested.
{assign var=foo value=[1,[9,8],3]}
So PHP array(....) is just [....] in Smarty templates. |
|
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
|