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

Call a php function within Smarty unserialize

 
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 -> Tips and Tricks
View previous topic :: View next topic  
Author Message
Orpheus
Smarty n00b


Joined: 28 Oct 2009
Posts: 3

PostPosted: Wed Oct 28, 2009 1:22 pm    Post subject: Call a php function within Smarty unserialize Reply with quote

Hello,

Would it be possible to call a built-in function from PHP (unserialize) within a Smarty template ?
Indeed, i gather data from atable and one field is serialized and i would like to unserialize it, to display it clearly....

I think this is the more appropriate way and i assume that Smarty allows to call built-in functions.


Thanks a lot !
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Wed Oct 28, 2009 4:07 pm    Post subject: Reply with quote

try:

{$foo|unserialize}
Back to top
View user's profile Send private message Visit poster's website
Orpheus
Smarty n00b


Joined: 28 Oct 2009
Posts: 3

PostPosted: Thu Oct 29, 2009 8:33 am    Post subject: Reply with quote

How is it possible to see all elements contained?

{foreach from =$foo|unserialize item=job}
{job.Element1}
{job.Element2}



?
Back to top
View user's profile Send private message
Orpheus
Smarty n00b


Joined: 28 Oct 2009
Posts: 3

PostPosted: Thu Oct 29, 2009 9:52 am    Post subject: Reply with quote

Thank you very much mohrt !
i've finally achieved to obtain what i expected Wink


Thanks a lot !!!
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 -> Tips and Tricks 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