[Smarty] 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