Help Plz - recursive include - variable not visible
Posted: Sat Mar 29, 2008 4:27 pm
Hello There,
I am trying to include one php file that includes another php file. All three files are in different folders. The variables in first php page is not visible.
Folder Structure:
Webapp
-config/config.php
-incs/header.php <- includes config
-public_html/index.php <- includes config.
Variables in config.php from header.php is not visible in index.php.
If I run header.php, config.php variables are visible.
Code:
index.php
------------------------------
header.php
-----------------------------
config.php
-------------------------------
-----
THx in advance
I am trying to include one php file that includes another php file. All three files are in different folders. The variables in first php page is not visible.
Folder Structure:
Webapp
-config/config.php
-incs/header.php <- includes config
-public_html/index.php <- includes config.
Variables in config.php from header.php is not visible in index.php.
If I run header.php, config.php variables are visible.
Code:
index.php
------------------------------
Code: Select all
<?php
require_once("../../incs/header.php");
head('Home');
foot();
?>
-----------------------------
Code: Select all
<?php
include_once("../config/config.php");
function head($title = " "){
?>
<html>
<head>
<title><? echo "$title - $glo_title"?></title>
</head>
<body>
<?php
}
function foot(){
?>
</body></html>
<?php
}
?>
-------------------------------
Code: Select all
<?php
/** TITLE */
global $glo_title;
$glo_title = "123auto";
/** USERNAME/PASSWORDS */
//MySQL
global $username;
global $password;
$username = "testuser";
$password = "test";
?>
THx in advance