All pastes #766685 Raw Edit

Zend_Layout

public text v1 · immutable
·published 2007-11-09 01:41 UTC
rendered paste body
index.php

// VIEW
    if (!$view = $cache->load('view') OR APPLICATION_STATE == 'development') {
        $view = new Zend_View();
        $view->addHelperPath($config->dir->viewhelper, 'My_View_Helper');
        $view->addHelperPath('../zendframework/incubator/library/Zend/View/Helper');
        $view->setScriptPath($config->dir->view);
        $view->menu = new hhMenu();
        $cache->save($view, 'view');
    }


    // VIEWRENDERER plugin
    $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
    $viewRenderer->setView($view);
    Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);

    $layout = new Zend_Layout(array(
        'layoutPath' => $config->dir->layout,
        'layout'     => 'site.phtml',
    ));



----------------------------------------------------------------------------------------------------------

site.phtml

<?php echo $this->render('__header.phtml'); ?>

	<div id="header"> <h1>header image</h1> </div>
	<div id="content">
		<div id="content_left"> <h1>left column</h1>
			<div id="MenuMain">
				<ul>
					<?php
						foreach ($this->menu->getMenuItems() as $menuitem)
						{
						    if ($menuitem["isAllowed"]) {
						        echo '    <li><a href="' . $menuitem["url"] . '">' . $menuitem["desc"] . '</a></li>'. "\n";
							}
						}
					?>
				</ul>
			</div>
 		</div>
		<div id="content_right">
			<?php print $this->placeholder('Zend_Layout')->content ?>
		</div>
	</div>

<?php echo $this->render('__footer.phtml'); ?>

----------------------------------------------------------------------------------------------------------

header.phtml

<?php $config = Zend_Registry::get('config');?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title><?php echo $this->escape($this->title); ?></title>
	<meta name="keywords" content=<?php echo '"'.$config->meta->keywords.'"' ?>/>
	<meta name="description" content=<?php echo '"'.$config->meta->description.'"' ?>/>
	<link rel="stylesheet" type="text/css" media="screen" href=<?php echo '"'.$config->css->site.'"' ?>/>
	<link rel="stylesheet" type="text/css" media="screen" href=<?php echo '"'.$config->css->menu.'"' ?>/>
	<link rel="stylesheet" type="text/css" media="screen" href=<?php echo '"'.$config->css->form.'"' ?>/>
	<link rel="stylesheet" type="text/css" media="screen" href=<?php echo '"'.$config->css->view.'"' ?>/>
</head>
<body>

----------------------------------------------------------------------------------------------------------

<?php $config = Zend_Registry::get('config');?>

    <div style="clear: both; margin-bottom: 25px;"></div>
	<div id="footer">
		<h1>footer image</h1>
		<img src=<?php echo '"'.$config->dir->images.'valid-xhtml10.png"' ?> border="0" alt=" | w3c valid xhtml 1.0 "/>
		<img src=<?php echo '"'.$config->dir->images.'valid-css.png" ' ?>    border="0" alt=" | w3c valid css "/>
		<img src=<?php echo '"'.$config->dir->images.'zf0.png"' ?>           border="0" alt=" | powered by Zend Framework "/>
	</div>
</body>
</html>