On 4/11/2013 10:48 AM, Rafnews wrote:
basic php question. Variables within any function are local to that
function (except for superglobals like $_POST, $_SESSION, etc.). In
order to reference a var defined/used outside that function you must add
a global statement in the function:
On 11.04.2013 13:34, Rafnews wrote:
I would like to insert a piece of HTML code inside several pages.
all pages are differently named.
i need in each page to find a particular tag, let's say <div
id="#submenu">...</div> (so based on its ID and tagname) and inside it
to insert my PHP/HTML code.
how can i do that ?
Ok i can write an include_once('myfile.php');
however if i have an array in this file, other files where is the
include_once(); do not recognize the array.
here is an extract of this file to include (submenu.php):
$submenu = array();
$submenu = array('id' => 1,'class'=>'menuitem1');
$submenu = array('id' => 2,'class'=>'menuitem2');
// function in the same file
// here i do not have access to the previous array $submenu define
outside the function
as it is included the function DisplayMenu should also have access to
$submenu array, no ?
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php