views:

31

answers:

2

In my index/index action, I'm calling a form class that I created, and output the form in the index.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.

A: 

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();
Alexander.Plutov
+3  A: 

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

David Weinraub