Variables in include file, added in header block, not available to view file
Hello everyone, please i need some help.
I got a php file with some variables (like a config file) that i required (included) in the header of my header file (header block).
When i try to access these variables from my view files, i get a php error : undefined variable.
so i then did an include of the same file in the view file, every thing works except i am getting nasty notices and errors such as:
A PHP Error was encountered
Severity: Notice
Message: Constant THUMBSTEXT already defined
Filename: confs/e2config.php
Line Number: 24
Please help, this project was due last week.
Comments
<?php require($_SERVER['DOCUMENT_ROOT'].'/########/assets/confs/e2config.php');?>
contents of e2config.php (some)
/play.png" title="<?php echo PLAYTEXT;?>" border="0" align="absmiddle" class="controls" rel=" " /> |
Maybe you could try and include these constants in the global.php variables file, instead of using an includes?
like with these
define('THUMBSTEXT', 'Toggle Thumbs');
define('GALLERIESTEXT', 'View Galleries');
define('INFOTEXT', 'View Info');
define('PLAYTEXT', 'Play Slideshow');
define('PAUSETEXT', 'Pause Slideshow');
and the global.php file your referring to, is the global variables file in the view folder ?
thanks in advance
i thought of that, but some css and js paths depend on some variables in the include file.
Thanks though