[geeklog-devel] Proposal: Plugin vars in templates

Joe Mucchiello joe at ThrowingDice.com
Sat Aug 11 21:39:26 EDT 2007


At 09:09 PM 8/11/2007, Blaine Lang wrote:
>I don't see the need to add these generic template vars to all of 
>our templates because there would likely just be confusion and 
>collision when the ratings plugin uses {plg1} and myplugin uses 
>{plg1}. A generic name is just confusing as to what is' being used for.

I provided a convention for handling this. It wouldn't be hard to 
explain. Worst case, the plugin writers should be encouraged to use 
set_var('plg1', $content, true). If all plugins do that, {plg1} can 
be used by multiple plugins.

>The plugin API PLG_templateSetVars has been an excellent addition to 
>GL and very flexible - granted you need to update a template to add 
>the variable if it does not exist but it's not hard to distribute 
>those updates or directions. If you don't have a plugin and want to 
>use this feature which has been the case for me on a few projects, 
>adding your code to CUSTOM_templateSetVars is straight forward and 
>you can test for the template file you need to to set the new variables for.

Asking admins to modify templates is inelegant. Granted, this is a 
band-aid but how does it really hurt add the fields.

>There just may be a few more places we want to add PLG_templateSetVars();

There's really no place it shouldn't be called. Anywhere there's a 
final $T->parse(), there should probably be a call to 
PLG_templateSetVars just before it.


----
Joe Mucchiello
Throwing Dice Games
http://www.throwingdice.com 




More information about the geeklog-devel mailing list