开发者

Zend_Form outputs without main HTML HEAD BODY tags

In my index/index action, I'm calling a form class that I created, and output the form in the ind开发者_运维问答ex.phtml view like this

<?php
echo $this->form;

But when I view the page source, all I'm getting is the form markup. I don't get any HTML HEAD BODY tags to make this a valid markup page. How do I add these to all my pages?

I have layouts/scripts/layout.phtml but I'm not sure what's the correct way to use it.


It sounds like you have not enabled the layouts.

The typical way to so this is via your configs/application.ini file:

resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.layout.layout = "layout"

The file application/layouts/scripts/layout.phtml should have the html code for your template, typically employing (as noted in the answer by @Alkexander) the view-helpers headLink(), headScript(), etc.

See Zend Framework: Documentation: Using Zend_Layout


Use common layout. In this layout with help of View Helpers create doctype, head...

$this->getHead('jquery');
$this->headLink()->appendStylesheet('/styles/common.css');
echo $this->headTitle();
echo $this->headMeta();
echo $this->headScript();
echo $this->headLink();
echo $this->headStyle();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜