|
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 |
zhora Smarty n00b
Joined: 17 May 2010 Posts: 1
|
Posted: Mon May 17, 2010 2:53 pm Post subject: Problème assign classe Smarty |
|
|
Bonjour,
J'ai le code suivant:
Code: |
...
require_once(_DIR_ .'/tools/smarty/Smarty.class.php');
require_once(_DIR_ .'/classes/application.class.php');
$app->initialize_smarty();
$app->tpl_assign(array(
'lang' => $lang,
'language' => $language,
'site_css' => SITE_URL .'/themes/'. APP_THEME .'/css/style.css',
));
...
|
La classe Application:
Code: |
class Application extends Smarty
{
function initialize_smarty()
{
$this->Smarty();
$this->template_dir = _DIR_ .'/themes/'. APP_THEME .'/';
$this->compile_dir = _DIR_ .'/tools/smarty/compile/';
$this->config_dir = _DIR_ .'/tools/smarty/configs/';
$this->cache_dir = _DIR_ .'/tools/smarty/cache/';
$this->caching = false;
}
function tpl_assign($varnames)
{
foreach($varnames as $varname => $value) {
if($value) {
$this->assign($varname, $value);
}
}
}
function tpl_display($resource_name)
{
$this->display($resource_name);
}
...
|
et la classe images:
Code: |
class images extends Application
{
function add($id)
{
if(!$images = $this->exec("SELECT a.id, a.name, a.product_id, b.name AS product_name FROM ". _DB_PREFIX_ ."images a, ". _DB_PREFIX_ ."products b WHERE a.product_id=".$id." AND b.id=".$id."")) $this->print_error();
$this->tpl_assign(array('images' => $this->get_rows($images)));
$this->tpl_display('admin/images.tpl');
}
|
Mon problème:
Dans la fonction add de la classe images que j'appelle d'un autre fichier je dis d'afficher le template 'admin/images.tpl' mais ça ne marche pas.
Je sais que le code n'est pas bon mais je ne trouve pas comment faire.
L'erreur retournée est:
Quote: | Warning: Smarty error: unable to read resource: "admin/images.tpl" in ../Smarty.class.php |
Pouvez-vous m'aider? |
|
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
|