Précédent   Forum des professionnels en informatique > PHP > Bibliothèques et frameworks > Templates > Smarty
Smarty Forum d'entraide sur le moteur de templates Smarty. Avant de poster -> FAQ Smarty et Cours Smarty
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 16/04/2007, 15h15   #1
Candidat au titre de Membre du Club
 
Inscription : février 2007
Messages : 25
Détails du profil
Informations forums :
Inscription : février 2007
Messages : 25
Points : 11
Points : 11
Par défaut Problème Smarty + MVC

salut pour tous
il s'agit d'integrer smarty dans une app web en php selon le modele mvc.j'a 1 ptit prob d'affichage des résultat,
j'ai testé cet exemple qui marche parfaitement
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
      require_once "HTML/QuickForm.php";
      require_once 'HTML/QuickForm/Renderer/ArraySmarty.php';
      require_once 'Smarty.class.php';
 
      $form = new HTML_QuickForm('frmTest', 'get');
      $form->addElement('header', 'hdrTesting', 'Testing Smarty');
      $form->addElement('text', 'txtFirstName', 'First name?');
      $form->addElement('text', 'txtLastName', 'Last name?');
      $form->addElement('text', 'txtAge', 'Age?');
      $form->addElement('text', 'txtTelephone', 'Telephone number?');
      $form->addElement('reset', 'btnClear', 'Clear');
      $form->addElement('submit', 'btnSubmit', 'Submit');
      if ($form->validate()) {
          # If the form validates then freeze the data
          $form->freeze();
      }
 
      // Create the template object
      $tpl =& new Smarty;
      $tpl->template_dir = '.';
      $tpl->compile_dir  = '/tmp';
 
      // Create the renderer object     
      $renderer =& new HTML_QuickForm_Renderer_ArraySmarty($tpl);
 
      // build the HTML for the form
      $form->accept($renderer);
 
      // assign array with form data
      $tpl->assign('form_data', $renderer->toArray());
 
      // parse and display the template
      $tpl->display('smarty1.tpl');
?>
et initialement dans mon application j'ai une classe
Citation:
A extends HTML_QuickForm_page {pour creer les element }
une deuxième
Citation:
B extends HTML_QuickForm_Action {pour faire les actions necessaire}
et une troixieme
Citation:
C {
pour instancier les deux précedentes et une methode pour l'affichage}
mais lorsque j'integre Smarty la template n'est pas pris en charge ,comme si elle n'existe pas .
quelqu'un peut avoir une idée ?
merci
mnr_nfo est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 27/04/2007, 16h14   #2
Membre Expert
 
Avatar de eric.pommereau
 
Homme ERIC POMMEREAU
Ingénieur intégration
Inscription : décembre 2004
Messages : 683
Détails du profil
Informations personnelles :
Nom : Homme ERIC POMMEREAU
Âge : 38
Localisation : France

Informations professionnelles :
Activité : Ingénieur intégration
Secteur : Administration - Collectivité locale

Informations forums :
Inscription : décembre 2004
Messages : 683
Points : 1 294
Points : 1 294
Bonjour,

Qu'est ce que ça t'affiche au final ? une page blanche ?

Quel est exactement le message d'erreur ?
eric.pommereau est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 02h48.


 
 
 
 
Partenaires

Hébergement Web