Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

include_php directory question

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
m3avrck
Guest





PostPosted: Fri Jul 18, 2003 3:07 am    Post subject: include_php directory question Reply with quote

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





PostPosted: Fri Aug 01, 2003 6:38 pm    Post subject: Reply with quote

Any ideas, anyone?
Back to top
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Fri Aug 01, 2003 6:51 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Fri Aug 01, 2003 6:54 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
m3avrck
Guest





PostPosted: Fri Aug 01, 2003 7:29 pm    Post subject: Reply with quote

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
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP