Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [ZendFramework] Jak użyć samego Zend_Form?
nexis
post
Post #1





Grupa: Zarejestrowani
Postów: 1 012
Pomógł: 109
Dołączył: 26.09.2003
Skąd: nexis.pl

Ostrzeżenie: (0%)
-----


Chciałbym dołożyć formularz do istniejącej już aplikacji napisanej w "czystym PHP".
  1. <?php
  2. # Ścieżka do ZF
  3. set_include_path(implode(PATH_SEPARATOR, array(
  4. realpath('./library/'),
  5. )));
  6.  
  7. # Formularz
  8. require_once 'forms/order.php';
  9. $form = new Form_Order();
  10. echo $form;
  11. ?>

  1. <?php
  2.  
  3. require_once 'Zend/Form.php';
  4.  
  5. class Form_Order extends Zend_Form
  6. {
  7. public function init()
  8. {
  9. $this->clearDecorators();
  10.  
  11. $this->addElement('text', 'test', array(
  12. 'label' => 'Test:'
  13. ));
  14.  
  15. return $this;
  16. }
  17. }

Na wyjściu dostaję komunikat:
Cytat
Warning: Exception caught by form: ViewHelper decorator cannot render without a registered view object Stack Trace: #0 /volume1/web/formularz/library/Zend/Form/Element.php(1971): Zend_Form_Decorator_ViewHelper->render('') #1 /volume1/web/formularz/library/Zend/Form/Decorator/FormElements.php(101): Zend_Form_Element->render() #2 /volume1/web/formularz/library/Zend/Form.php(2626): Zend_Form_Decorator_FormElements->render('') #3 /volume1/web/formularz/library/Zend/Form.php(2641): Zend_Form->render() #4 /volume1/web/formularz/index.php(11): Zend_Form->__toString() #5 {main} in /volume1/web/formularz/library/Zend/Form.php on line 2646


Jak użyć samego Zend_Form?
Go to the top of the page
+Quote Post
seth-kk
post
Post #2





Grupa: Zarejestrowani
Postów: 444
Pomógł: 79
Dołączył: 26.05.2009

Ostrzeżenie: (0%)
-----


  1. $view = new Zend_View();
  2. $form = new Form_Order();
  3. $form->setView($view);
  4. echo $form;
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 22:27