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 36 37 38 39 40
|
define('ROOT', '.');
define('PAGE_EN_SMARTY', ROOT.'/fichier_smarty.tpl');
// Largement recommande avec QF
error_reporting(E_ERROR);
// Le smarty
require_once ROOT.'/include/smarty/libs/Smarty.class.php';
class Smarty_Config extends Smarty {
function Smarty_Config()
{
$this->Smarty();
$this->template_dir = ROOT.'/templates/';
$this->compile_dir = ROOT.'/smarty/templates_c/';
$this->config_dir = ROOT.'/smarty/configs/';
$this->cache_dir = ROOT.'/smarty/cache/';
//$this->caching = true;
}
}
require 'HTML/QuickForm.php';
require 'HTML/QuickForm/Renderer/ArraySmarty.php';
// require 'HTML/QuickForm/Renderer/Array.php';
$form = new HTML_QuickForm('mainform', 'post');
// Instanciers des elements
$form->addElement('textarea', 'nomchamps');
// Example de groupe
$buttons[] = &HTML_QuickForm::createElement('reset', 'btnClear', 'Clear');
$buttons[] = &HTML_QuickForm::createElement('submit', 'btnSubmit', 'Submit');
$form->addGroup($buttons);
/*
C'est la que se joue la gestion du renderer
*/
$renderer =& new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$form->accept($renderer);
$smarty = new Smarty_Config();
$smarty->assign('form', $renderer->toArray());
$smarty->display(PAGE_EN_SMARTY.".html"); |
Partager