 |
Forum PHP Romania - Discutii despre PHP, MySQL, Javascript, AJAX, etc Comunitatea PHP Romania
|
| Subiectul anterior :: Subiectul următor |
| Autor |
Mesaj |
adyphp
Data înscrierii: 23/Dec/2004
Mesaje: 7
|
| Trimis: Mie Ian 26, 2005 2:25 pm Titlul subiectului: Sa fie PEAR gresit facut oare? |
|
|
Am vrut sa folosesc PEAR cu QuickForm mi-am adus QuickForm.php versiunea 3.2.4pl1 (stable) impreuna cu directorul aferent de pe net si le-am pus in directorul html din php/pear.
Am pus apoi linile de cod intr-un fisier php:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html"
charset="UTF-8">
<title>Testing PEAR HTML_QuickForm</title>
</head>
<body>
<?php
// Load the main class
require_once 'HTML/QuickForm.php';
// Instantiate the HTML_QuickForm object
$form = new HTML_QuickForm('firstForm');
// Set defaults for the form elements
$form->setDefaults(array(
'name' => 'Joe User'
));
// Add some elements to the form
$form->addElement('header', null, 'QuickForm tutorial example');
$form->addElement('text', 'name', 'Enter your name:', array('size' => 50, 'maxlength' => 255));
$form->addElement('submit', null, 'Send');
// Define filters and validation rules
$form->applyFilter('name', 'trim');
$form->addRule('name', 'Please enter your name', 'required', null, 'client');
// Try to validate a form
if ($form->validate()) {
echo '<h1>Hello, ' . htmlspecialchars($form->exportValue('name')) . '!</h1>';
exit;
}
// Output the form
$form->display();
?>
</body>
</html>
Merge si nu da erori daca scot instructiunea $form->display();
Daca insa o pun da urmatoarea eroare Fatal error: Call to undefined function: getattributes() in c:\apache\php\pear\HTML\QuickForm\Renderer\Default.php on line 188
M-am uitat in c:\apache\php\pear\HTML\QuickForm\Renderer\Default.php la linia 188 si este un apel al functiei in linia respectiva. Normal ar trebui sa mearga. Fara instructiunea $form->display(); nu pot sa fac nimic ca nu pot sa vad formularul.
Ce e de facut?
E gresala mea sau a celor care au facut PEAR-ul? |
|
| Sus |
|
aurelian
Data înscrierii: 01/Iun/2003
Mesaje: 833
Locație: Bucuresti
|
| Trimis: Mie Ian 26, 2005 2:53 pm Titlul subiectului: |
|
|
HTML_Quick-form are ca dependinta pachetul HTML_Common (deci trebe sa il instalezi si pe asta).
sugestie: foloseste installerul pear ptr. a instala pachetele.
apropo, mie imi merge codul pe care l-ai pastat mai sus. |
|
| Sus |
|
Emil
Data înscrierii: 16/Noi/2003
Mesaje: 301
Locație: echo $REMOTE_ADDR
|
| Trimis: Mar Feb 08, 2005 3:09 am Titlul subiectului: |
|
|
| yeah.. foloseste installerul pt ca foarte multe pachete au o gramada de dependente. |
|
| Sus |
|
PHPRomania Bot
Bot Member
Data înscrierii: 27/Dec/2007
Mesaje: 1
Locaţie: Server Google |
| Trimis: Mie Dec 26, 2007 7:01 pm Titlul subiectului: Ad |
|
|
|
|
|
| Sus |
|
| |
|