Example view (using layout)
Code: Select all
<!-- add a css file and javascript to this layout -->
<?= $this->headLink()->appendStylesheet($this->url(array('stylesheet' => 'base.css'), 'stylesheets')); ?>
<?= $this->headScript()->appendFile($this->url(array('script' => 'image-gallery.js'), 'javascripts')); ?>
<h2>Image Gallery</h2>
<ul class="gallery">
<?= $this->partialLoop('image.phtml', $img) ?>
</ul>Code: Select all
<?= $this->doctype('HTML4_STRICT'); ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?= $this->headTitle("Some Application Title"); ?>
<?= $this->headStyle(); ?>
<?= $this->headScript(); ?>
<?= $this->headLink()->appendStylesheet($this->url(array('stylesheet' => 'base.css'), 'stylesheets')); ?>
</head>
<body>
<div id="container">
<h1><?= $this->link('Home'); ?></h1>
<?= $this->layout()->content; ?>
</div> <!-- /container -->
<?= $this->placeholder('debug'); ?>
<!-- start javascripts (loaded at end of body so as not to hold up the rest of the page during load) -->
<?= $this->inlineScript(); ?>
<!-- end javascripts -->
</body>
</html>
bootstrap.php
Code: Select all
// ..snip
$front->registerPlugin(new Q_Controller_Plugin_Debug($view), 1000); // viewRenderer is at like 99 or 100, so set to 1000 to make sure it comes as late as possible
// ..snipMy plugin (in case u wanted to see it)
Code: Select all
class Q_Controller_Plugin_Debug extends Zend_Controller_Plugin_Abstract
{
protected $view;
public function __construct(Zend_View_Abstract $view) {
$this->view = $view;
}
public function postDispatch(Zend_Controller_Request_Abstract $request) {
$front = Zend_Controller_Front::getInstance();
$this->view->headLink()->appendStylesheet($this->view->url(array('stylesheet' => 'debug.css'), 'stylesheets'));
$output = $this->view->render('elements/debug.phtml');
$this->view->placeholder('debug')->set($output);
}
}