Two questions:
1) Is there a new parse order document out there for EE2? I can only find EE1 parsing on the wiki.
2) I’m trying to do this (where myglobalvar is a global variable):
{exp:allow_eecode}{myglobalvar}{/exp:allow_eecode}Will this work? It isn’t for me, I’m assuming the plugin is just getting {myglobalvar} instead of the actual contents of it?
So I tried this (where the embed is the above code):
{exp:allow_eecode}{embed="tgroup/template}{/exp:allow_eecode}Still just seeing eecode, non-rendered. Is it possible to use a global var in a plugin like this? Thanks!
P.S. I can’t use snippets because the actual code is more complex and depends on the parsing order of global vars for the other functions.
Moved to Development and Programming by Moderator
I can help you with question 1. Lodewijk Schutte did a presentation at EECI 2010 on php in templates and parse order.
Presentation: http://www.slideshare.net/lodewijkschutte/php-in-templates-pain-or-pleasure
Parse order document: ee-parse-order.pdf
Hope that helps.
Hi Phire_SK,
The use of embeds is not automatically allowed with the allow_eecode plugin. As per the plugin page you have to set a parameter like this:
{exp:allow_eecode embed="y"}...{/exp:allow_eecode}Did Will’s post about Lodewijk’s presentation help you out?
Cheers
Greg
@Will, thanks very much for the help.
Thanks Will for giving me that info, it helps out a lot in understanding the new parsing.
Greg, I’m not trying to use the {embed} tag within my dynamic content, instead in my example I was using embed to bring in code from another template and wrap that with the allow_eecode.
It’s kind of like a big maze trying to figure out how to do this. Since plugins are always parsed before user defined global variables, I guess there is no way to get the content of a global variable to be used by a plugin. Is this conclusion true, or is there a trick?
Fair enough question.
The global variables that are used on the page can be picked by the user. What we did, was create a field for the channel that allows them to put it what global variables to use. They are usually blocks of code. This works great, except if we want some EE code within a global variable.
Since snippets get parsed very early (basically first), there is no way to allow for dynamic snippets in a template. I have to code the snippet in directly or else it won’t render. So you can’t have a field within a channel that the user can select snippets to use on a page the way we did for global variables.
So, I’m trying to find a way to allow global variables to use EE code, but it seems like the parse order prevents this even with a plugin.
Yes, Global Variables are going to be parsed far too early for what you are attempting to do. I wonder if Low Variables might help? I haven’t personally used it, but perhaps that could be part of your solution.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.