We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Quick parsing question

Development and Programming

PhireGuys's avatar
PhireGuys
525 posts
15 years ago
PhireGuys's avatar PhireGuys

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

       
Will Bolton's avatar
Will Bolton
30 posts
15 years ago
Will Bolton's avatar Will Bolton

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.

       
Greg Salt's avatar
Greg Salt
3,988 posts
15 years ago
Greg Salt's avatar Greg Salt

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.

       
PhireGuys's avatar
PhireGuys
525 posts
15 years ago
PhireGuys's avatar PhireGuys

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?

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
15 years ago
Lisa Wess's avatar Lisa Wess

I have to ask: why not just use a snippet? Why are you trying to use global variables for this?

       
PhireGuys's avatar
PhireGuys
525 posts
15 years ago
PhireGuys's avatar PhireGuys

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.

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
15 years ago
Sue Crocker's avatar Sue Crocker

At this point we’ve gone beyond general technical support. This is more of a Development question, moving to the Dev forum for additional community support.

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
15 years ago
Lisa Wess's avatar Lisa Wess

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.

       
PhireGuys's avatar
PhireGuys
525 posts
15 years ago
PhireGuys's avatar PhireGuys

Thanks, I’m going to check out that plugin.

In the end I just wanted confirmation that there was no sly workaround, so thanks for that.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.