Re: how to insert html code with PHP

From: Date: Thu, 11 Apr 2013 14:48:04 +0000
Subject: Re: how to insert html code with PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-320827@lists.php.net to get a copy of this message
On 11.04.2013 13:34, Rafnews wrote:
Hi, 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 ? thx. A.
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): <?php $submenu = array(); $submenu[] = array('id' => 1,'class'=>'menuitem1'); $submenu[] = array('id' => 2,'class'=>'menuitem2'); // function in the same file function DisplayMenu($title){ // 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 ?

« previous php.general (#320827) next »