sharing global directives
| From: | Papp, Gyozo | Date: | Wed, 03 Apr 2002 13:47:15 +0000 |
| Subject: | sharing global directives | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-3455@lists.php.net to get a copy of this message | ||
hi,
i'd like to know how you share your global variables and
constants acting as configure directives between scripts
and templates.
Let's have a constant "PHOTO_DIR"
define('PHOTO_DIR', '/path/to/gallery');
which must be accessed both at the application level
and at the presentation level (in the template) as well.
For example, within PHP script:
<?php
if ( file_exists(PHOTO_DIR.$picname) ){
// do some stuff
}
?>
within template:
<img src="{$PHOTO_DIR}{$another_pic}" alt="">
What would you suggest how to assign all these constants:
- in a auto-prepend file (which may be an option)
- enumerate them before $smarty->display()
Papp Gyozo
- pgerzson@freestart.hu