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

Where can I hold data? YUI plugin development.

Development and Programming

Phoebe's avatar
Phoebe
58 posts
17 years ago
Phoebe's avatar Phoebe

I am developing a plugin for adding YUI bits to EE. Most YUI functions require some dependancy javascript to be loaded, then some javascript specific to that function and then a bit of javascript code is run. This is the way I want to implement it.

The template might look like this:

.. my page header stuff
{yui_dependancies}     <---- this has all the javascript files required for tabs and tables and no duplicates

more of my template

{exp:yui:load type="tabs"}    <---- javascript for tabs loaded here

more of my template.....

[exp:yui:load type="tables"} <---- javascript for tables loaded here

As the plugin function load is called, the dependancies files are added to the global variable yui_dependancies so when global variables are parsed at the end of the template, the {yui_dependancies} should be replaced by the list of javascript files to load.

However, I can’t work out how to put stuff into $IN->global_vars[‘yui_dependancies’]. I have set the initial value in path.php and it is that original value that is displayed in the template.

Now there might be a whole better way of doing this and I am very open to ideas!

       
Jamie Poitra's avatar
Jamie Poitra
409 posts
17 years ago
Jamie Poitra's avatar Jamie Poitra

Phoebe,

Not sure I quite understand the question.

It seems you have a few different possible YUI functions that you want to allow users to load later in a template using this kind of syntax:

{exp:yui:load type="tabs"}

These functions have differing dependencies and you want to load only those dependencies that are actually needed for a given mix of functions.

Am I reading you correctly?

Jamie

       
Phoebe's avatar
Phoebe
58 posts
17 years ago
Phoebe's avatar Phoebe

Absolutely!

       
Jamie Poitra's avatar
Jamie Poitra
409 posts
17 years ago
Jamie Poitra's avatar Jamie Poitra

OK,

Here is my suggestion. Rather that try to keep track dynamically have parameter on the {dependencies} tag where you enter in all of the functions being used.

Doing it dynamically is going to be very difficult via a plugin because plugins are parsed as they occur in a template.

So if {dependencies} is above the items depending on it it will get parsed before them and thus not know what they are and what they are doing.

So you end up with something like this instead:

{yui_dependancies loaded="tabs|tables"} 

more of my template

{exp:yui:load type="tabs"}

more of my template.....

[exp:yui:load type="tables"}

Jamie

       

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.