|
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 |
yarco Smarty Regular
Joined: 20 Mar 2009 Posts: 39
|
Posted: Sun Jul 10, 2011 4:09 am Post subject: sugguest: add object support in $smarty->assign |
|
|
We could do foreach on an object, so if:
Code: |
$obj->name = 'yarco';
$obj->gender = 'male';
|
i would like smarty to assign it as an array.
Code: |
$smarty->assign($obj);
// as $smarty->assign(array('name' => 'yarco', 'gender' => 'male'));
// or as
// $smarty->assign('name', 'yarco');
// $smarty->assign('gender', 'male');
|
file: sysplugins/smarty_internal_data.php
line: 30
== change from ==
if (is_array($tpl_var)) // only work with array
== to ==
if (is_array($tpl_var) || is_object($tpl_var)) // also work with object
what's your mind? |
|
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
|