当我在动作助手的帮助下点击www.example.com/login时,我希望有一个登录表单。 我的controllers / helpers目录包含文件名 Login.php类是
在我的观看/ login / index.phtml中,我这样称呼它
<?= $this->loginForm; ?>
Login.php
<?
class Zend_Controller_Action_Helper_Login extends
Zend_Controller_Action_Helper_Abstract
{
function Login($a)
{
//Consists of form elements
}
}
?>
我收到以下错误---------
"Helper "login" does not support overloading via direct()"
如何显示表单以及错误是什么?
答案 0 :(得分:0)
我能够以这种方式做到这一点。
http://geekabyte.blogspot.nl/2012/08/understanding-zend-frameworks-plugin.html 在Bootstrap.php中
public function _initLoader()
{
//For configuring Zend Application to be aware of the Controller Action Helper
Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH .'/controllers/helpers');
}
LoginController.php
class LoginController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
$this->_helper->login->scream();
}
}
在controller / helpers / Login.php中
class Zend_Controller_Action_Helper_Login extends Zend_Controller_Action_Helper_Abstract
{
Public function scream()
{
echo "Here please help!!!";
}
}