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

Plugin parsing issue (template variable pair vs single variable)

Development and Programming

Brian Litzinger's avatar
Brian Litzinger
711 posts
16 years ago
Brian Litzinger's avatar Brian Litzinger

Moderator’s note: Moved to Plugins: Technical Assistance.

I have 2 plugins I’m working on, and each of them has the option to render out a value, or a number of values… so it can be either a variable pair, or single variable, e.g.

// Will print the calendar days of the current week
{exp:week_range}
    {day}
{/exp:week_range}

OR

// Will print out the current month name of the start date of the current week.
{exp:week_range get="month" format_month="F"}

My problem is, I can’t use both of these instances on the same page, or it borks the parsing and starts including templates within one another. If I include JUST the variable pair on the page, or even multiple instances of the single variable format it works fine. Is this a limitation of EE, or am I writing the plugins wrong?

       
silenz's avatar
silenz
1,651 posts
16 years ago
silenz's avatar silenz

Hm, it may be problematic that you seem to try to handle both behaviours in the same method. I never did that so I#m not 100% certain.

You could try to split up the applications into separate functions and do something along the line of this

{exp:week_range:days}
    {day}
{/exp:week_range:days}
{exp:week_range:month format_month="F"}
       
Brian Litzinger's avatar
Brian Litzinger
711 posts
16 years ago
Brian Litzinger's avatar Brian Litzinger

That is an excellent idea, I’ll give that a try, thanks!

       
Brian Litzinger's avatar
Brian Litzinger
711 posts
16 years ago
Brian Litzinger's avatar Brian Litzinger

That seemed to do the trick!

       

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.