making a extended setup for smartly effectively ??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
PHPycho
Forum Contributor
Posts: 336
Joined: Fri Jan 06, 2006 12:37 pm

making a extended setup for smartly effectively ??

Post by PHPycho »

suppose i have follwing file structure

Code: Select all

wwwroot>libs>smarty>Smarty.class.php
wwwroot>templates
---------->c_templates
wwwroot>admin>templates
------------------->c_templates
wwwroot>includes>smartySetup.php
smartySetup.php

Code: Select all

<?php
define("SMARTY_DIR","path/to/smarty/");
define("TEMPLATE_DIR","path/to/templates");
define("C_TEMPLATE_DIR","path/to/c_templates");

require_once (SMARTY_DIR."Smarty.class.php");
$smarty = new Smarty;
$smarty->compile_dir = "C_TEMPLATE_DIR";
$smarty->template_dir = "C_TEMPLATE_DIR";
?>
My problem:
1>sometimes the templates and c_templates are in admin and sometimes in wwwroot and sometimes may be in other directory
and the smarty setup file is in wwwroot>includes>smartySetup.php , which is included while displaying the .tpl file
what i want:
i want to make the path dynamic so that it works in all the cases , No matter where the smarty,templates,c_templates folder are .
2>
i wanna know:
making different compile fodler is effective (for example i have made one for admin templates and for wwwroot folder)
or making only one ?

Hope for the Best.
Thanks in advance to all of YOU !!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You could use an absolute path instead of a relative one. $_SERVER['DOCUMENT_ROOT'] may be of interest.

I don't think Smarty cares where you have it compile the templates. The question is, are you making it do more work compiling the same files into multiple locations?
Post Reply