|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
mikrocosm Smarty n00b
Joined: 19 Jul 2003 Posts: 3
|
Posted: Sat Jul 19, 2003 4:43 pm Post subject: using constants |
|
|
Hi,
another thing that should be easy:
i would like to set two constants DOCROOT and URLROOT to use in my templates AND my php-files in a setup.php.
Defining the Constant normally i can't find how to use them in a template (simply saying {DOCROOT} of course doesn't work ;-(
So question one: is there a way to access a constant?
now i assigned them to smarty
Code: | $smarty->assign('doc_root',DOCROOT); |
so i can access
but how i can i do this:
Code: | {include_php file="{$doc_root}/scripts/news.php"} |
? For some reason that doesn't work.
question two: what is wrong in that piece of code?
(i can't hardcode the DOCROOT, as i want everything to work on my testserver and my productionserver without changing code everytime _________________ Regards,
Mike Beck |
|
Back to top |
|
AZTEK Smarty Pro
Joined: 16 Apr 2003 Posts: 235 Location: Purdue University
|
Posted: Sat Jul 19, 2003 6:28 pm Post subject: |
|
|
Try Code: | {include_php file="$doc_root/scripts/news.php"} |
_________________ "Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|