Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Assign in Output Filter

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


Joined: 25 May 2012
Posts: 4

PostPosted: Fri May 25, 2012 9:45 pm    Post subject: Assign in Output Filter Reply with quote

Hi,

I am running an output filter which retrieves the name of the template to be displayed and loads another file based on that name. The loaded file contains an array to be displayed in the template. When I attempt to assign that array to the template in the output filter it did not work.

Any ideas?

Thanks
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Sat May 26, 2012 10:29 am    Post subject: Reply with quote

An output filter runs on the final rendered template output. So you can modify the html output, but any assignments of new variables will have no effect as the rendering is already done.

May be you can run your code as post filter which will effect the compiled template.
Back to top
View user's profile Send private message
jravenscroft
Smarty n00b


Joined: 25 May 2012
Posts: 4

PostPosted: Sat May 26, 2012 5:47 pm    Post subject: Reply with quote

Thanks for your reply.

I thought as much. So I'd have to do my own parsing at this point to get it to work? Which kind of defeats the point of doing it this way.

Running it as a pre compilation filter wouldn't work I don't think as the content is dynamic.
Back to top
View user's profile Send private message
jravenscroft
Smarty n00b


Joined: 25 May 2012
Posts: 4

PostPosted: Sat May 26, 2012 5:48 pm    Post subject: Reply with quote

Ah I misread your post. I'll try a post filter.

Thanks
Back to top
View user's profile Send private message
jravenscroft
Smarty n00b


Joined: 25 May 2012
Posts: 4

PostPosted: Mon May 28, 2012 2:45 pm    Post subject: Reply with quote

Just tried this. It didn't work as it only affects the template when it's compiled, and like I said, the content will be dynamic so I need to run it in an output filter.

So back to my question.. the only way I could achieve this would be to carry out the parsing myself?

Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Plugins 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