Zend_Form操作和方法默认显示<form action="" method="post">
......我的愿望不是那样......只需写下<form>
..这可能吗?
我该怎么办?
答案 0 :(得分:1)
你可以简单地执行以下,但实际上没有理由这样做! 为什么你想要空表格标签?
将此添加到您的配置中,让框架“知道”您的新助手
resources.view.helperPath.My_View_Helper =“我的/查看/助手”
然后在文件库/ My / View / Helper.php中创建类
class My_View_Helper_Form extends Zend_View_Helper_Form
{
/**
* Render HTML form without any attributes on the form-tag
*
* @param string $name Form name
* @param null|array $attribs HTML form attributes
* @param false|string $content Form content
* @return string
*/
public function form($name, $attribs = null, $content = false)
{
$info = $this->_getInfo($name, $content, $attribs);
extract($info);
if (!empty($id)) {
$id = ' id="' . $this->view->escape($id) . '"';
} else {
$id = '';
}
if (array_key_exists('id', $attribs) && empty($attribs['id'])) {
unset($attribs['id']);
}
$xhtml = '<form>';
if (false !== $content) {
$xhtml .= $content
. '</form>';
}
return $xhtml;
}
}
当您正确配置视图资源时,它将自动使用