[Pmwiki-users] Dev Q3: Avoiding Problems With Variable Scope in Add-On Scripts

Steven Leite steven_leite
Tue Mar 30 07:21:56 CST 2004


What's the best way to initialize variable's in an add-on so they have limited scope.

For example, if you have to add-ons scripts that have been included in your config.php, 
and both of the add-ons have a variable like "$temp" or "$Output" (not in the scope of a
function, but declared as a user-definable variable at the top of the php file), how to
keep them seperate from each other?

Also, in the case of an external file like:  myaddon-config.php

I'm thinking the only way to keep the scope local is to 
a) create the local variables inside of a function instead of at the top of the php add-on script
b) in the case of an external config file, load it from a function, and not at the top of the php add-on.

Am I correct in this thinking? Anyone have any better ideas?

-S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://contra.vosn.net/pipermail/pmwiki-users_pmichaud.com/attachments/20040330/c2d0b829/attachment.htm


More information about the pmwiki-users mailing list