[wp-hackers] Variable Scope

Viper007Bond viper at viper007bond.com
Tue Mar 11 04:02:37 GMT 2008


Consider writing your plugin as a class. It's a far superior method for all
but the most simple of plugins.

Then you can just do $this->var.

On Mon, Mar 10, 2008 at 6:39 PM, Chris Poteet <cpoteet at siolon.com> wrote:

> I want to have a wider scope for variables in my plugin, but for some
> reason it's not working.  For instance:
>
> $variable = get_option('variabletest');
>
> function dummy() {
>    global $variable;
>    echo $variable;
> }
>
> Neither of those work.  Am I doing something wrong (I must be).
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Viper007Bond | http://www.viper007bond.com/ | http://www.finalgear.com/


More information about the wp-hackers mailing list