Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Assigning variables inside fetch() - from plugins

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


Joined: 05 Jan 2013
Posts: 3

PostPosted: Sat Jan 05, 2013 10:52 pm    Post subject: Assigning variables inside fetch() - from plugins Reply with quote

Hello!

I'm using approach 'php from templates', not common 'templates from php'. So, when I call template fetch(), I have smarty object already initialized inside application.

I'm calling plugin load_module, that calls function from php and this function assigns data using global $smarty variable. In smarty 3.0.8 all worked fine, but when I was upgraded to latest 3.1.12, assigning of variables was broken.

In other words:
- initialize global $smarty
- call fetch()
- call get_page() PHP function inside of template via plugin load_module
- get_page calls $smarty->assign('PAGE', $page)
- fetch() do rest of magic implementing assigned variables into template text
- (in 3.0.Cool I got fetched template with $PAGE assigned
- (in 3.1.12) I got fetched template WITHOUT $PAGE assigned

As I understand, assigning smarty variables via global smarty object does not works while fetching templates (it uses old copy of variables inside fetch()).

What should I do to assign variables that way using global $smarty object?

Thanks in advance!
Back to top
View user's profile Send private message
oleg_king
Smarty n00b


Joined: 05 Jan 2013
Posts: 3

PostPosted: Sat Jan 05, 2013 11:42 pm    Post subject: Reply with quote

I forgot about this problem and have found my own topic about similar behavior:
http://www.smarty.net/forums/viewtopic.php?t=21141

Sorry for repeated question.

Workaround from that topic still works, so I just wanted to ask will this default behavior be modified in some of next releases (at least, as user choice)? Thanks!
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Sun Jan 06, 2013 11:46 am    Post subject: Reply with quote

It will be modified with version 3.2
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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