...

View Full Version : making a extended setup for smartly effectively ??



PHPycho
02-27-2007, 08:28 PM
suppose i have follwing file structure


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

smartySetup.php


<?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 !!

GJay
02-27-2007, 11:53 PM
there's not really a need to have separate compile directories, better to keep that separate and individual as it needs to be writable, and other things don't and shouldn't be.

As for templates, I normally use something like:


/
templates/
admin/
main/
shared/

so, have subdirectories within a templates directory, rather than having 2 directories at the top level. There would be nothing to stop you having something like:


if(is_admin_page()) {
$smarty->template_dir='./admin_templates';
}
else {
$smarty->template_dir='./templates';
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum