Too much of $GLOBALS[] a problem??
| From: | Ow Mun Heng | Date: | Fri, 18 Jul 2003 01:35:03 +0000 |
| Subject: | Too much of $GLOBALS[] a problem?? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-155711@lists.php.net to get a copy of this message | ||
Hi All,
Just a quick question on this. In my scripts, I'm using A LOT Of
$GLOBALS['my_parameter'] to get the declared values/string. 1 example below
:
function display_menu_html()
{
echo '<table class="width100" cellspacing="0">'."\n";
echo '<tr>'."\n";
echo "\t".'<td class="menu">'."\n";
echo "\t".'<a href="home.php">' . $GLOBALS['home'] .
"</a>
 |\n";
echo "\t".'<a href="view_tracker.php">' .
$GLOBALS['view_tracker'] .
"</a>  |\n";
echo "\t".'<a href="initialise_fa.php">' .
$GLOBALS['initialise_fa']
. "</a>  |\n";
echo "\t".'<a href="mass_initialiase_fa.php">' .
$GLOBALS['mass_initialiase_fa'] . "</a>  |\n";
echo "\t".'<a href="Summary.php">' .
$GLOBALS['overall_summary'] .
"</a>  |\n";
echo "\t".'<a href="account.php">' .
$GLOBALS['edit_account'] .
"</a>  |\n";
echo "\t".'<a href="logout.php">' .
$GLOBALS['logout'] . "</a>
 |\n";
echo "\t</td>\n";
echo "\t".'<td class="right" style="white-space:
nowrap">'."\n";
echo "\t".'<form input="post"
action="jump_to_fa.php">'."\n";
echo "\t".'<input type="text" name="fa_id"
size="12"
class="bold-small" />'."\n";
echo "\t".'<input type="submit" value="' .
$GLOBALS['goto_fa'] . '"
class="small" /> '."\n";
echo "</form>\n";
echo "\t</td>\n";
echo "</tr>\n";
echo "</table>\n";
}
This isn't really a Problem but.. is it bad programming practice?? Or I
should just write another function that can return the values/string?
Any thots?
Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia
DID : 03-7870 5168