including global varialbes? (2 posts)

  1. Zoom123
    Posted 9 years ago #

    How can I include a global variable with a plugin (or even directly in the template)?

    I noticed that if in the header.php I create a variable $x = "something"; then if I try to echo this variable from another part of the template (e.g. in the index.php) then that variable doesn't exist. I tried setting it to global but it didn't work either.

  2. Pizdin Dim
    Posted 9 years ago #

    Have you tried using $GLOBALS['x']? That will work, irrespective of whether you're in a function or not.

Topic Closed

This topic has been closed to new replies.

About this Topic