私はこのようないくつかのフォームを持っています:
class Form_RegistrationForm extends Zend_Form {
public function init()
{
[...]
$username = new Zend_Form_Element_Text('username');
$email = new Zend_Form_Element_Text('email');
[...]
$elements = array($username, $email, [...]);
foreach($elements as $element) {
$element->addPrefixPath('Form_Decorator', 'Form/Decorator', 'decorator');
$element->addValidator('CustomErrors');
$this->AddElement($element);
}
}
}
私は自分のデコレータを持ってい/application/modules/Form/Decorator/CustomErrors.php
ます。私は次の方法でデコレータに名前を付けました:class Form_Decorator_CustomErrors extends Zend_Form_Decorator_Abstract
問題は、Zend がデコレータを見つけられないことです。エラーが表示されます: メッセージ: 名前 'CustomErrors' のプラグインがレジストリに見つかりませんでした。使用したパス: Zend_Validate_: Zend/Validate/
Zend が私の定義したパスを無視しているように見えるので、ちょっとおかしいです。
私の appication.ini ファイル:
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
resources.view[] =
url.full = http://87.199.35.20/Kreskoweczki/bp/
resources.db.adapter = PDO_MYSQL
resources.db.params.host = localhost
resources.db.params.username = root
resources.db.params.password =
resources.db.params.dbname = kreskoweczki
resources.db.params.charset = utf8
resources.db.params.prefix = kres_
;Mail transport settings
;mail.smpt - when false - sendmail is used
mail.smtp=true
mail.host=127.0.0.1
mail.smtpconfig.name=localhost
mail.smtpconfig.port=25
;mail.smtpconfig.auth = plain | login | crammd5
mail.smtpconfig.auth=
mail.smtpconfig.username=
mail.smtpconfig.password=
mail.from=no-reply@example.com
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
私のindex.php:
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_include_path(
'../library/' . PATH_SEPARATOR .
'../application/modules/' . PATH_SEPARATOR .
'../application/' . PATH_SEPARATOR .
get_include_path()
);
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()->run();