Hi there,
I'm pretty much a complete noob when it comes to ZF. I've been a procedural
PHP developer for about 1-2 years. I'm dabbling in ZF though right now I
think it best to refrain using the full MVC model in my work. Mostly b/c I
don't feel comfortable with it at the moment.
So I've gone ahead and attempted to use Zend_Layout without MVC and it
appears that there isn't much useful documentation on it. Which makes it
painful for me to learn :-/
I most likely have made a mistake/overlooked something but this is what I've
done.
I've created my configuration include class as such:
require_once 'Zend/Layout.php';
$layout = new Zend_Layout();
$layout->setLayoutPath("{$_SERVER['DOCUMENT_ROOT']}/layout/")
->setLayout("main");
I've placed main.phtml in /layout/ and in my index.php scrip I've attempted
echo $layout->render(); but I keep getting this error:
*Fatal error*: Class 'Zend_Controller_Action_HelperBroker' not found in *
/Users/ddibiase/Documents/workspace/testzend/lib/Zend/Layout.php* on line *
505*
My main.phtml looks like so:
<?= $this->docType('XHTML1_STRICT') ?>
<html>
<head>
<?= $this->headTitle() ?>
<?= $this->headScript() ?>
<?= $this->headStylesheet() ?>
</head>
<body>
<?= $this->partial('header.phtml') ?>
<div id="mainbody">
<img src="images/mainsplash.png">
<div id="subbod"><div>Find. Hire. Boost your projects with our simple
to use freelance engine!</div></div>
</div>
<?= $this->partial('footer.phtml') ?>
</body>
</html>
Very simple, very basic. The header and footer files are in their proper
spots.
I'm also wondering as a second part that now I'm able to render the layout,
I also want to include parts into the content and nav sections. Furthermore
I want to do this via Zend_View. From what I read in the documentation I can
use layout to initiate a view specific for my current page. So I'm assuming
that I create the view and then before I render and echo out the full layout
I set the ->content value with my view render like this:
$layout->content = $view->render();
Does this make sense? Have I understand it properly? I would love to just
read documentation and do this myself, but all of the ZF work seems to be
tightly connected to MVC. :-/
Thanks in advance,
David