Reply to Variable scoping - issues with global and multiple includes

Your name:

Reply:


Posted by hrishikesh.mehendale on 04/10/06 23:24

Hi All, Sorry if I'm just repeating other questions, but I can't find
an answer for this particular problem: I have my main index.php file,
which looks so: <?php include "includes/header.php"; #defines a global
variable called $lang include "includes/functions.php"; # some required
functions safe_include "main_page.html"; # user-defined function that
tries to # include main_page.html.$lang
or gives a warning message echo "Language available to index.php at
line XYZ is -$lang-"; #-- to check empty value include
"includes/footer.php"; #page footer ?> and header.php looks so: <?php
global $lang; $lang = "en"; ?> footer.php looks like so: <?php echo
"Language is set to -$lang-"; # should print out current language in
use ?> Now the problem is, the $lang variable is available to all
statements in between, upto and including the safe_include statement.
Unfortunately, footer.php refuses to see the variable. What can be
the problem? Thanks Hrishikesh

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация