 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Andrew Podner: Lithium Building Views Using Layouts
by Chris Cornutt February 13, 2013 @ 11:54:04
Andrew Podner has written up a new post for his site today about building views/layouts in Lithium and make the maintenance of your application simpler in the long run.
The last time I wrote about the Lithium framework, the focus was on getting information out of a MySQL database. Once you have that information, in many cases you will want to show it to the user. In this installment, we are going to look at how Lithium implements layouts for your output in an effort to improve reusability of code, which ultimately improves the developer's ability to quickly get applications up and running and it makes maintenance down the road that much easier.
He talks about the basic structure of an application (on the file system) and where the layouts and views live inside it. He includes a sample layout that defines areas for things like title, scripts, character set and main content. Code is also included showing how to use it in your application. There's also a bit about setting up a default layout in your "_init" method if you'd like to use it across the entire application.
voice your opinion now!
lithium view layout tutorial framework
Constantin Bosneaga: Using layout pattern with CodeIgniter
by Chris Cornutt October 01, 2012 @ 11:57:08
Constantin Bosneaga has a recent post to his site that the CodeIgniter users out there could find helpful. It's an example of using the Layout pattern in a CI app to make a more flexible layout thanks to a library (source included in the post).
CodeIgniter is great framework by its simplicity. But when I moved from CakePHP, I really missed layout pattern. CodeIgniter documentations offers this way to include non-changing site header and footer. For sure it isn't flexible and does not show page structure in a clear way. For many years I use layout pattern. Layout describes whole page as a template with blocks for header, menu, content, etc.
He uses this library to handle the data for your layout, including the header items (like CSS, Javascript) and the definition of a global template. It also allows you to do template inheritance, making it simpler to reuse partial templates ("blocks").
voice your opinion now!
layout designpattern codeigniter tutorial library
Rob Allen: Module specific layouts in ZF2
by Chris Cornutt September 17, 2012 @ 10:04:10
Rob Allen has a new post to his site about module-specific layouts in Zend Framework 2 via a module from Evan Coury.
If you need different layout scripts to be rendered for different modules in Zend Framework 2, then Evan Coury has made this extremely easy. His new module EdpModuleLayouts is just the ticket! Once installed, you simply have to add a new array to a config file in the config/autoload folder.
The update is just a simple "module_layouts" setting that lets you specify it based on the module name by giving it a layout path, He explains the script a bit more in the comments and points to this other post for more information about modules handling their own layouts.
voice your opinion now!
module layout zendframework2 edpmodulelayouts evancoury
Evan Coury's Blog: Module-specific layouts in Zend Framework 2
by Chris Cornutt May 11, 2012 @ 08:07:44
Evan Coury has a new Zend Framework 2 related blog post looking at how to use module specific layouts in your application (even though, technically, it's more related to the controller).
There's really no such thing as "module-specific" anything in ZF2, so what we're really talking about is the topmost namespace of the controller being dispatched. So in the case of MyModuleControllerSomeController, the topmost namespace would be MyModle. In most cases, this will be the name of a given module.
He gives a quick piece of sample code showing a "Module" class that attaches an event on the dispatch of its request. Inside this event, he grabs the controller (target) and updates the layout via a call to the "layout" method. This is all handled in the "init" method of the module, so it should "just work" when the module is used.
voice your opinion now!
module layout zendframework2 controller
3 Engineers Blog: 3 Step Layouts in Zend Framework
by Chris Cornutt April 04, 2011 @ 13:04:06
In a recent post to the 3 Engineers blog, they take the usual "Two Step" approach the Zend Framework takes to generating view data (Zend_View + Zend_Layout) and takes it up one more step by using Three Step Layouts with a simple wrapper.
While the Two Step View pattern creates a reasonable paradigm for seperating layout presentation from page presentation, enabling Three-level Inheritance allows for even better separation. In other words, using 3 Step Layouts is a possible and often necessary investment to make when implementing front-ends in Zend Framework projects; they allow fine grain re-usability that provides for a DRYer presentation layer.
They have a three step process you can follow (complete with code snippets) that'll have you working with their 3 layers easily. The wrapper is a sort of "boostrap" for the layout. The nested layout is then pulled into this wrapper (for example's sake, theirs is called "default") and then the view can be served as normal and placed into the content location. There's also a bit of code showing how to switch out the layout if there's ever a need - like different layouts for the admin, user and main parts of your application.
voice your opinion now!
zendframework twostep threestep layout wrapper view zendview zendlayout
Rob Allen's Blog: A form in your layout
by Chris Cornutt October 11, 2010 @ 12:11:07
If you've ever wanted to have a form that stuck with every page of your Zend Framework application, Rob Allen might just have your solution in his latest blog post.
I recently received an email asking for my advice about how to handle a form that appears on every page. I want to add a newsletter sign up box to layout.phtml so it will appear on every page. The layout->content() comes from several different action controllers... So how do I handle the newsletter sign up? I thought that the answer is long-winded enough to be worth writing a blog post about. One way to do this is to use a action helper, so let's build a simple application to show this solution.
He walks you through the creation of the simplest part first - the form that will live inside of the view helper. He chose a signup type of form with a username, email and submit button. He helps you create an action helper and the view helpers to help inject the form into the layout of each page. Then, with a simple call to "$this->signupForm()" you can drop it in anywhere in the layout.
voice your opinion now!
form layout zendframework tutorial viewhelper actionhelper
PHPBuilder.com: Managing Zend Framework Layouts
by Chris Cornutt May 25, 2010 @ 11:49:47
On PHPBuilder.com there's a new tutorial on layouts in Zend Framework applications. The tools the framework gives you makes things much simpler when it comes to changing layouts and updating the general structure of your site.
Gone is the need to devise strategies for important tasks such as maintaining page headers and footers, separating the bulk of a page's logic from its interface, and managing the code repeatedly used throughout the site to carry out special formatting actions. Instead, you can just embrace the framework's conventions and move on to the next battle. This article introduces you to some of the fundamental concepts behind managing layouts within your Zend Framework-driven applications.
He shows how to enable the layout management tools and how to create a sample layout to ensure it's working. You can also switch layouts, disable them and use a few of the helpers that come with the tool to make it simpler for you and make your development time faster.
voice your opinion now!
manage zendframework layout tutorial
NETTUTS.com: Context Includes
by Chris Cornutt October 15, 2008 @ 10:23:51
The NETTUTS blog has another WordPress-related post today that looks at "context includes" - changing the look and feel of the postings based on the content type they're tagged with.
The great thing about WordPress is that it doesn't limit how content is displayed, but provides a 'framework' of ways to do so. Even better, it's possible to change the display according to the content. When writing this tutorial it was hard to explain what's going on... But the best way is this: the post will be displayed within the loop according to its content - or contextual differences. Either way, it's including specific files that match up to the category of the post.
There's plenty of code to go around introducing you to the parts of the typical WodPress install you'll be working with and some CSS to help you style the resulting changes. You can download the source and check out a live demo of the end result.
voice your opinion now!
tutorial wordpress context tag type layout css demo
|
Community Events
Don't see your event here? Let us know!
|