Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [ZF] formsy i fatal error :|, poczatkujacy
matchor
post
Post #1





Grupa: Zarejestrowani
Postów: 46
Pomógł: 0
Dołączył: 1.05.2005

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


Fatal error: Class 'forms_ContactForm' not found in /xxx/application/controllers/RegisterController.php on line 38
mam takie pliki w takich lokalizacjach
  1. /xxx/application/forms/ContactForm
  2. /xxx/public/index.php
  3. /xxx/controllers/RegisterController.php


=============================
/xxx/application/forms/ContactForm
  1. <?php
  2.  
  3. class forms_ContactForm extends Zend_Form
  4. {
  5. public function __construct($options = null)
  6. {
  7. parent::__construct($options);
  8. $this->setName('contact_us');
  9.  
  10. $title = new Zend_Form_Element_Select('title');
  11. $title->setLabel('Title')
  12. ->setMultiOptions(array('mr'=>'Mr', 'mrs'=>'Mrs'))
  13. ->setRequired(true)->addValidator('NotEmpty', true);
  14.  
  15. $firstName = new Zend_Form_Element_Text('firstName');
  16. $firstName->setLabel('First name')
  17. ->setRequired(true)
  18. ->addValidator('NotEmpty');
  19.  
  20. $lastName = new Zend_Form_Element_Text('lastName');
  21. $lastName->setLabel('Last name')
  22. ->setRequired(true)
  23. ->addValidator('NotEmpty');
  24.  
  25. $email = new Zend_Form_Element_Text('email');
  26. $email->setLabel('Email address')
  27. ->addFilter('StringToLower')
  28. ->setRequired(true)
  29. ->addValidator('NotEmpty', true)
  30. ->addValidator('EmailAddress');
  31.  
  32.  
  33. $submit = new Zend_Form_Element_Submit('submit');
  34. $submit->setLabel('Contact us');
  35.  
  36. $this->addElements(array($title, $firstName,
  37. $lastName, $email, $submit));
  38.  
  39. }
  40. }



=============================
/xxx/controllers/RegisterController.php
  1. public function indexAction()
  2. {
  3.  
  4. $form = new forms_ContactForm(); // <========= tu sie wykrzacza



=============================

/xxx/public/index.php :

  1. <?php
  2. // Set the initial include_path. You may need to change this to ensure that
  3. // Zend Framework is in the include_path; additionally, for performance
  4. // reasons, it's best to move this to your web server configuration or php.ini
  5. // for production.
  6. set_include_path(implode(PATH_SEPARATOR, array(
  7. realpath(dirname(__FILE__) . '/../library'),
  8. )));
  9.  
  10. // Define path to application directory
  11. defined('APPLICATION_PATH')
  12. || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
  13.  
  14. // Define application environment
  15. defined('APPLICATION_ENV')
  16. || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
  17.  
  18. /** Zend_Application */
  19. require_once 'Zend/Application.php';
  20.  
  21. // Create application, bootstrap, and run
  22. $application = new Zend_Application(
  23. APPLICATION_ENV,
  24. APPLICATION_PATH . '/configs/application.ini'
  25. );
  26. $application->bootstrap();
  27. $application->run();
Go to the top of the page
+Quote Post

Posty w temacie


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: 24.08.2025 - 23:17