|
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 |
m3avrck Guest
|
Posted: Fri Jul 18, 2003 3:07 am Post subject: include_php directory question |
|
|
Hi all! Well I've got this Smarty code working fine: Code: | {include_php file="file:D:\\My Documents\\web design\\websites\\martin motorsports\\smarty\\templates\\menu.php"} |
However, the directory structure is pretty grotesque. I have a setup.php file which declares the intial directory, and also sets the template_dir. And this PHP page I'm trying to include is in the template directory, but I couldn't figure out a way to use the variables I already code in this line of Smarty code.
Any ideas how I fix this? Thanks. |
|
Back to top |
|
m3avrck Guest
|
Posted: Fri Aug 01, 2003 6:38 pm Post subject: |
|
|
Any ideas, anyone? |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Fri Aug 01, 2003 6:51 pm Post subject: |
|
|
i'd guess to set php's include-path to
"D:\\My Documents\\web design\\websites\\martin motorsports\\smarty\\templates\\"
and {include_php file="menu.php"}
include_php does not make any use of $smarty->template_dir since it includes php-files and not templates.
HTH |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Fri Aug 01, 2003 6:54 pm Post subject: |
|
|
after reading your message again: a second thought is:
in php:
$smarty->assign('php_dir', $smarty->template_dir.DIRECTOY_SEPARATOR);
and in the template:
{include_php file="`$php_dir`menu.php"} |
|
Back to top |
|
m3avrck Guest
|
Posted: Fri Aug 01, 2003 7:29 pm Post subject: |
|
|
Ah, got it. I just set this in my setup script:
$this->trusted_dir= $this->template_dir;
And that way I could include all of my PHP scripts that were in my template directory!
Perfect, thanks for the help. |
|
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
|