Re: [SMARTY] template and dir
| From: | Monte Ohrt | Date: | Fri, 21 Mar 2003 17:44:45 +0000 |
| Subject: | Re: [SMARTY] template and dir | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8822@lists.php.net to get a copy of this message | ||
You must set your smarty configs _before_ using is_cached(), otherwise
it doesn't know where to find them.
$smarty->template_dir = '../templates/';
$smarty->compile_dir = '../templates_c/';
$smarty->config_dir = '../conf/';
$smarty->cache_dir = '../cache/';
$smarty->plugins_dir = array('../plugins');
if(!$smarty->is_cached('fr/index.tpl')) {
$smarty->config_load('smarty.conf');
...
}
Monte
On Fri, 2003-03-21 at 11:40, Elgi wrote:
> Bonjour Smarty,
>
> I have now too :
> define('SMARTY_DIR','../smarty/');
> @require(SMARTY_DIR.'Smarty.class.php');
> $smarty = new Smarty;
>
> if(!$smarty->is_cached('fr/index.tpl')) {
> $smarty->template_dir = '../templates/';
> $smarty->compile_dir = '../templates_c/';
> $smarty->config_dir = '../conf/';
> $smarty->cache_dir = '../cache/';
> $smarty->plugins_dir = array('../plugins');
> $smarty->config_load('smarty.conf');
> }
>
> $smarty->display('fr/index.tpl');
>
> but the cache is don't good :/
> The debug open smarty.conf always
> In Smarty.class.php i have
> var $caching = 1;
> var $cache_lifetime = 60;//60 is for test
>
> What is the $smarty->xxxx i do redefined when i work in dir "fr" for
> example ?
>
> Elgi
>
> Le vendredi 21 mars 2003 à 18:18:57, vous écriviez :
>
> E> Bonjour Smarty,
>
> E> debug.tpl don't work
> E> i test :
> E> $smarty->debug_tpl = '../smarty/debug.tpl';
> E> but it's not good
>
> E> Elgi
>
> E> Le vendredi 21 mars 2003 à 18:00:48, vous écriviez :
>
> E>> Bonjour Monte,
>
> E>> Thanks, it's good now, i have :
>
> E>> define('SMARTY_DIR','../smarty/');
> E>> @require(SMARTY_DIR.'Smarty.class.php');
> E>> $smarty = new Smarty;
>
> E>> if(!$smarty->is_cached('fr/index.tpl')) {
> E>> $smarty->template_dir = '../templates/';
> E>> $smarty->compile_dir = '../templates_c/';
> E>> $smarty->config_dir = '../conf/';
> E>> $smarty->cache_dir = '../cache/';
> E>> $smarty->config_load('smarty.conf');
> E>> }
>
> E>> $smarty->display('fr/index.tpl');
>
> E>> Elgi
>
> E>> Le vendredi 21 mars 2003 à 17:52:51, vous écriviez :
>
> MO>>> If you know the relative path, then do this:
>
> MO>>> require('../smarty/Smarty.class.php');
>
> MO>>> Smarty will figure out SMARTY_DIR on its own from there.
> MO>>> Otherwise, SMARTY_DIR needs to be an absolute path.
>
> MO>>> define('SMARTY_DIR', '/absolute/path/to/smarty/dir/');
> MO>>> require(SMARTY_DIR . 'Smarty.class.php');
>
> MO>>> Monte
>
> MO>>> On Fri, 2003-03-21 at 10:17, Elgi wrote:
> >>>> Bonjour smarty-general,
> >>>>
> >>>> I have a dir "fr" with index.php
> >>>> and in "templates/fr" => index.tpl
> >>>>
> >>>> fr/index.php :
> >>>> define('SMARTY_DIR','smarty/');
> >>>> @require('../'.SMARTY_DIR.'Smarty.class.php');
> >>>> $smarty = new Smarty;
> >>>> $smarty->display('fr/index.tpl');
> >>>>
> >>>> Smarty say "unable to read template", why ?
> >>>> --
> >>>> Cordialement,
> >>>> Elgi
--
Monte Ohrt <monte@ispi.net>