|
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 |
jravenscroft Smarty n00b
Joined: 25 May 2012 Posts: 4
|
Posted: Fri May 25, 2012 9:45 pm Post subject: Assign in Output Filter |
|
|
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 |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sat May 26, 2012 10:29 am Post subject: |
|
|
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 |
|
jravenscroft Smarty n00b
Joined: 25 May 2012 Posts: 4
|
Posted: Sat May 26, 2012 5:47 pm Post subject: |
|
|
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 |
|
jravenscroft Smarty n00b
Joined: 25 May 2012 Posts: 4
|
Posted: Sat May 26, 2012 5:48 pm Post subject: |
|
|
Ah I misread your post. I'll try a post filter.
Thanks |
|
Back to top |
|
jravenscroft Smarty n00b
Joined: 25 May 2012 Posts: 4
|
Posted: Mon May 28, 2012 2:45 pm Post subject: |
|
|
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 |
|
|
|
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
|