Hi all,

I'm making a site with a dynamic menu based on IF statements and DB
queries, but have this little problem which I can't understand the
reason. My programming method is based upon an application.php file
which controls the hole site and paths, template files for the header &
footer and main PHP files which includes all the needed files that I
mentioned before.

As an example of this, the header TITLE tag has a <?=$TITLE?> variable
to take a different title for each page and after that, I put a
$LOCATION variable to tell the menu() function which page is being
displayed (different menus for products, about us, etc.) but the menu()
function (fetched from a library) is not recognizing this $LOCATION
variable. I'm declaring it as a GLOBAL inside the function, but nothing
happens. Here's part of my code:

This is part of my product's index.php file:

<SNIP>

<?

require ("../application.php");
$TITLE = "Joyería Mara";
$LOCATION = "";
include ("$CFG->templatedir/header.inc");

?>
<TR>
<TD VALIGN=top>
<P><!--COMIENZO DE CUERPO--><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0
WIDTH="100%" HEIGHT="100%"> <TR> <TD VALIGN=top WIDTH=200> <P><TABLE
BORDER=0 CELLSPACING=0 CELLPADDING=15 WIDTH="100%"> <TR> <TD> <?

menu();

?>

</SNIP>

===========================

And this is the menu() function:

<SNIP>

function menu(){
GLOBAL $LOCATION;
if ($LOCATION = "productos"){
GLOBAL $MENU_NAME, $MENU_BACK, $MENU_LINK, $CFG;
$MENU_NAME = "Nosotros";
$MENU_LINK = "".$CFG->wwwroot."/nosotros";
$MENU_BACK = "000066";
menu_def();
unset($GLOBALS['MENU_BACK'], $GLOBALS['MENU_NAME'],
$GLOBALS['MENU_LINK']);

GLOBAL $MENU_NAME, $MENU_BACK, $MENU_LINK;
$MENU_NAME = "Productos";
$MENU_LINK = "".$CFG->wwwroot."/productos";
$MENU_BACK = "999999";
menu_def();
unset($GLOBALS['MENU_BACK'], $GLOBALS['MENU_NAME'],
$GLOBALS['MENU_LINK']);

GLOBAL $MENU_NAME, $MENU_BACK, $MENU_LINK;
$MENU_NAME = "Regístrese";
$MENU_LINK = "".$CFG->wwwroot."/registrese";
$MENU_BACK = "000066";
menu_def();
unset($GLOBALS['MENU_BACK'], $GLOBALS['MENU_NAME'],
$GLOBALS['MENU_LINK']);

GLOBAL $MENU_NAME, $MENU_BACK, $MENU_LINK;
$MENU_NAME = "Contacto";
$MENU_LINK = "".$CFG->wwwroot."/contacto";
$MENU_BACK = "000066";
menu_def();
unset($GLOBALS['MENU_BACK'], $GLOBALS['MENU_NAME'],
$GLOBALS['MENU_LINK']); } else if ($LOCATION = "nosotros"){ echo "hi"; }
else{ echo "none"; } }

</SNIP>

==============================

Any thoughts? Thanks

Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to