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

Problème d'arborescence de site

 
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 -> Language: French
View previous topic :: View next topic  
Author Message
moins52
Smarty n00b


Joined: 14 Mar 2008
Posts: 3

PostPosted: Fri Mar 14, 2008 6:36 am    Post subject: Problème d'arborescence de site Reply with quote

Bonjour,

Je souhaite faire une classe générique, mère de toutes les classes qui générent des templates.
L'objectif est de factoriser certains traitements.
En version simplifiée cela donne :

Arborescence du site
Code:
racine
|_dossier
|    |_Header.class.php
|    |_dossierTemplate
|    |    |_header.tpl
|    |_dossier
|         |_Page.class.php
|         |_dossierTemplate
|             |_page.tpl
|         
|_ClassMere


Classe Header
Code:
class Header extends ClassMere {
      
   // Constructor
   public function __construct() {
      parent::__construct('header.tpl');
      
      // Default parameters
      $this->currentModule = '';
   }
   
   // Process
   public function process () {
      [...]
   }
}


Classe Page
Code:
class Page extends ClassMere {
      
   // Constructor
   public function __construct($connection) {
      parent::__construct('index.tpl');
   }
   
   // Process
   public function process () {
      $header = new Header();
      $this->tpl->assign("header",$header->fetch());
      [...]
   }
}


Classe Mere
Code:
ClassMere {
   // Constructor
   public function __construct($templateFileName) {
      $this->tpl = new Smarty;
      $this->tpl->template_dir = "dossierTemplate/";
      $this->tpl->compile_dir = "compiled/";
      $this->templateFilePath = $templateFileName;
   }
   
   // Display view
   public function display () {
      $this->process ();
      $this->tpl->display($this->templateFilePath);
   }
}


Lorsque j'appelle header.php tout fonctionne bien mais lorsque j'appelle page.php.

Warning: Smarty error: unable to read resource: "header.tpl" in [...]Smarty.class.php on line 1092

Si je copie un header.tpl dans "dossier/dossierTemplate/dossierTemplate" avec page.tpl là ça fonctionne.

Comment faire pour qu'il pointe bien vers le bon dossier template ?

Merci de votre aide
Back to top
View user's profile Send private message
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 -> Language: French 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