I am developing a website in PHP and I would like to use a mvc framework to do this as I want to gain experience with PHP frameworks.
I have looked at Zend, CakePHP, and CodeIgniter and I have not been able to find an intuitive way to accomplish this.
What I need to do is create a layout that will be for example:
<html>
<head>
<!--scripts go here-->
</head>
<body>
<div id='banner'></div>
<div id='menu'><?php $this->layout()->menu ?></div>
<div id='container'><?php $this->layout()->content ?></div>
<div id='ads'><?php $this->layout()->ads ?>
<div id='footer'>blah</div>
</body>
</html>
I am looking for a framework that could do this simply without a lot of hacks as this should be simple to accomplish from my perspective.
This would pull the menu, content, and ads from separate controllers and views and would of course be dynamic content. I do not want to put the menu code into every view…
Maybe this is simple and I am just going about it the wrong way?
Any help is appreciated.
Thank you,
-Ben
Symfony can do what you are looking for using a mix of concepts.
In your case the layout would have the main content included using the template logic which is the core of the view layer and the other items would be either fragments or components depending on how much of the model they would need to access.
The Symfony documentation has a full explanation of this.