Call to protected HTML_QuickForm2_Renderer_Array::__construct() from invalid context
Aclaro estoy siguendo el ejemplo que encontre en un tema aqui mismo de Casius
Gracias de antemano y espero me puedan ayudar y perdon por las molestias que pueda causar
les dejo el codigo del tpl y el php
Código PHP:
require_once "HTML/QuickForm2.php";
require_once 'HTML/QuickForm2/Renderer/Array.php';
require_once 'Smarty/libs/Smarty.class.php';
$form = new HTML_QuickForm2('frmTest', 'get');
$form->addElement('text', 'txtFirstName')->setLabel('First name?');
$form->addElement('text', 'txtLastName')->setLabel('Last name?');
$form->addElement('text', 'txtAge', 'Age?')->setLabel('Last name?');
$form->addElement('text', 'txtTelephone')->setLabel('Telephone number?');
$form->addElement('reset', 'btnClear')->setLabel( 'Clear');
$form->addElement('submit', 'btnSubmit')->setLabel('Submit');
if ($form->validate()) {
# If the form validates then freeze the data
$form->freeze();
}
// Create the template object
$tpl=& new Smarty();
$tpl->template_dir = 'templates';
$tpl->compile_dir = 'templates_c';
// Create the renderer object
$renderer =& new HTML_QuickForm2_Renderer_Array($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('test.tpl');
//echo $form;
?>
y el tpl
Código HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- $Id: smarty-guide.tpl,v 1.1 2005/03/03 19:26:54 kae Exp $ --> <html> <head> <title>Smarty template demonstration</title> <style type="text/css"> {literal} th { text-align: right; } {/literal} </style> </head> <body> <h2> {$form_data.header.hdrTesting} </h2> <form {$form_data.attributes}> <!-- Display the fields --> <table> <tr> <th>{$form_data.txtFirstName.label}</th> <td>{$form_data.txtFirstName.html}</td> <th>{$form_data.txtLastName.label}</th> <td>{$form_data.txtLastName.html}</td> </tr> <tr> <th>{$form_data.txtAge.label}</th> <td>{$form_data.txtAge.html}</td> <th>{$form_data.txtTelephone.label}</th> <td>{$form_data.txtTelephone.html}</td> </tr> <!-- Display the buttons --> <tr> <td align="center" colspan="4"> {$form_data.btnClear.html} {$form_data.btnSubmit.html} </td> </tr> <!-- Display the copyright --> <tr> <td style="font-size:11px; color: navy; text-align: center" colspan="4"> ©2004 Tiger Computing Ltd </td> </tr> </table> </form> </body> </html>