di******@hotmail.com (SA) wrote in message news:<48**************************@posting.google. com>...
hello,
i have many pages (page1.php .. page100.php) and each of them include
some fixed subpages (top.php, bottom.php).
each subpage (top.php, bottom.php) uses a variable ("theme") defined
in its "parent" (one of the pageX.php).
this variable is also used (not only defined) in the parent page
itself. i would like to have the variable "theme" defined in a single
external file, instead of defyning it for every page. is it possible?
sorry for the probably stupid question, im new to php.
thank you in advance.
lx
Hi,
Yes, you can include a fixed external file which declares and defines
all global variables to be used. For example you can create a file
(config.php)
define some variables here ($globTheme = 'classic').
In all other files just include this file as first statement.
Afterwards it will be available to the main file and all other
included files. But remember that whenever you change the value of a
variable, old value will get lost (depends on the scope of variable).
regards,
rahul