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

sugguest: add object support in $smarty->assign

 
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 3
View previous topic :: View next topic  
Author Message
yarco
Smarty Regular


Joined: 20 Mar 2009
Posts: 39

PostPosted: Sun Jul 10, 2011 4:09 am    Post subject: sugguest: add object support in $smarty->assign Reply with quote

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
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 3 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