Hi All,

I'm just playing with Zend_Layout and have a quick question. What I'd like to do is have a three part view. I'd like my designer to design a wrapper "template" that consists of the markup surrounding the output of action views. This is exactly what Zend_Layout does so perfect! but if possible I'd like the designer templates to exclude the doctype, head and <html> and <body> tag stuff and stick strictly to what comes after <body>. That way designers don't need to worry about the non- design stuff.

The question is how to wrap the head and whatnot around the layout?

I thought of extending the ViewRendered render() method to accomplish this, which would work, however I wasn't sure if there was a native way to have a Zend_Layout within a Zend_Layout so that I could have:

doc.phtml:

<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title><?= $this->headTitle() ?></title>
    <?= $this->headScript() ?>
    <?= $this->headStyle() ?>
</head>
<body>
   <?= $this->layout()->content ?>
</body>
</html>

which includes the following designer layout.phtml in "content":

<div id="content">
        <!-- renders /nav/menu -->
        <div id="nav"><?= $this->layout()->nav ?></div>
        <!-- renders /foo/index + /comment/fetch -->
        <div id="content"><?= $this->layout()->content ?></div>
</div>

which includes the action.phtml template in "content".


Thanks.

- Jeffrey

Reply via email to