Javascript 向表单元素添加自定义装饰器后缺少侧栏
侧栏位于layout.phtml文件中。我很困惑为什么在我的表单中添加一个装饰器会导致我的边栏。。。嗯,事实上,在Javascript 向表单元素添加自定义装饰器后缺少侧栏,javascript,zend-framework,markdown,Javascript,Zend Framework,Markdown,侧栏位于layout.phtml文件中。我很困惑为什么在我的表单中添加一个装饰器会导致我的边栏。。。嗯,事实上,在部分#main之后的每一件事——我正在使用HTML5——都会丢失 layout.phtml ... /* scripts and all */ ... <body> <header> ... </header> <nav> ... </nav> <div class="clear" />
部分#main
之后的每一件事——我正在使用HTML5——都会丢失
layout.phtml
... /* scripts and all */ ...
<body>
<header> ... </header>
<nav> ... </nav>
<div class="clear" />
<section id="main">
<?php echo $this->navigation()->breadcrumbs(); ?>
<?php echo $this->layout()->content; ?>
</section>
<aside id="sidebar"> ... </aside>
<footer> ... </footer>
</body>
和我的表单init()
-
... // adding form elements
// call loading of default decorators manually
$this->loadDefaultDecorators();
// override decorator for body
$this->getElement('body')
->setDecorators(array(
'ViewHelper',
'Errors',
array('Description', array('tag' => 'p', 'escape' => false)),
'Label',
new Application_Form_Decorator_WmdPreview,
array('HtmlTag', array('tag' => 'p'))
));
// disable autoloading of default decorators
$this->setDisableLoadDefaultDecorators(true);
。。。隐马尔可夫模型。。。我现在注意到,来自视图源的html是可以的
<p><label for="body" class="optional">Post body</label>
<textarea name="body" id="body" rows="24" cols="80"></textarea>
<label style="margin-top: 10px">Preview</label><div class="wmd-preview" /></p>
帖子正文
预演
但firebug的输出不是
...
<textarea name="body" id="body" rows="24" cols="80"></textarea>
<label style="margin-top: 10px">Preview</label>
</p> <!-- why is this here !!! -->
<div class="wmd-preview">...</div><!-- and this out of the p!!! -->
</form>
</section>
<!-- all my content supposed to be here is missing! -->
</body>
。。。
预览
...
javascript问题?从哪里来的
解决方案
不要使用
而是使用
。同样像@DavidW所说的,我在中没有,我相信标签只能包含。尤其是
中的
使HTML无效。Firefox/Firebug可能已经尽了最大的努力,但最终还是被它噎住了。也许使用
而不是div可以解决问题。或者干脆不把它放在中。一个div看起来适合他的用途。嗯,我发现问题似乎是“
”vs“
”但是“
”无效吗?
...
<textarea name="body" id="body" rows="24" cols="80"></textarea>
<label style="margin-top: 10px">Preview</label>
</p> <!-- why is this here !!! -->
<div class="wmd-preview">...</div><!-- and this out of the p!!! -->
</form>
</section>
<!-- all my content supposed to be here is missing! -->
</body>