> > Would it be possible to make all hard-coded variables beginning with $_
> > automatically global? I've found useful to set some variables per page
> > to $_PAGE variable (for example $_PAGE['title'] etc) that would be nice
> > to get available to all functions without extra procedures (like global
> > command). The best way could be that $_ variables can't be defined by
> > any user-input (forms, cookies etc)...
> > Well, that's a explanation. I hope that someone would give any hint
> > concerning this subject. :)
> You already have $GLOBALS as a global (scope wise) variable, just add to
> that if you want.
> $GLOBALS['page_title'] = 'etc';

Or, if you want/need to be really anal about naming conventions, you can 
do something along the following (continuing from John's example):

$GLOBALS['_PAGE']['title'] = 'Page Title';
$GLOBALS['_PAGE']['css_file'] = '/some/absolute/path/css_file.css';

function whatever() {

  $_PAGE = &$GLOBALS['_PAGE'];

  echo $_PAGE['title'];
  echo $_PAGE['css_file'];

}

Chris

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

Reply via email to