Rather than having the following scenario:
$GLOBALS['foo'] = 'foo';
$GLOBALS['fee'] = 'fee';
The following would be much cleaner and portable while still allowing
the ease of use of $GLOBALS based configuration:
$GLOBALS['myProjectName']['foo'] = 'foo';
$GLOBALS['myProjectName']['fee'] = 'fee';
Cheers,
Rob.
On Thu, 2003-07-17 at 22:58, Curt Zirzow wrote:
> Ow Mun Heng <[EMAIL PROTECTED]> wrote:
> > 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>
> >
> > [...]
> >
> > }
> >
> > 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?
>
>
> yes and no, that is rather a debatable question.
>
> To make my functions that echo stuff cleaner I usually do stuff like:
>
> function show_html() {
> <?
> <table class="width100" cellspacing="0">
> <tr>
> <td class="menu">
> <a href="someplace.php"><?php echo $var?></a>
> </td>
> </tr>
> </table>
> ?>
> }
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
.---------------------------------------------.
| Worlds of Carnage - http://www.wocmud.org |
:---------------------------------------------:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the |
| stuff of nightmares grasp for your soul. |
`---------------------------------------------'
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php