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

Variable Conflicts Inter-Plugin?

Development and Programming

Paramore's avatar
Paramore
40 posts
13 years ago
Paramore's avatar Paramore

Hey everyone,

I’m probably missing something very juvenile here, but I’m writing a plugin that passes an array to the template class’ parse_variables function that looks something like this:

- 0
 - url (string)
 - name (string)
 - items (array)
    - 0
       - title (string)
       - url (string)

And so in my template, my tags would looks something like this:

{exp:myspecialplugin:get_entries}
     The top-level URL is: {url}
     {items]
          Item Title: {title}
          Item URL: {url}
     {/items}
{/exp:myspecialplugin:get_entries}

The problem with my code is that it appears the {items} URL variable is conflicting with the top-level URL variable. Am I crazy? I thought that EE’s template parser would parse outward by default and so the variable conflicts shouldn’t occur? Is there any suggested means of working around this issue without prefixing every inner array?

Thanks for any insight you can provide.

  • Jesse
       
Dan Decker's avatar
Dan Decker
7,338 posts
13 years ago
Dan Decker's avatar Dan Decker

Hi Jesse,

You are right that the top level variable is being overwritten by the lower level variable.

ExpressionEngine will do this in almost all cases that I’m aware of. You’ll need to “scope” the variable with a prefix.

In case I’m totally wrong, I’m moving this over to Development and Programming where the dave Community likes to poke around. They may have some seasoned insight to help you along.

Cheers,

       

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.