Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

NetTuts.com:
Programming With Yii2: Exploring MVC, Forms and Layouts
Feb 03, 2015 @ 17:10:38

NetTuts.com has posted the latest part of their "Programming with Yii2" series today that dives deeper into the functionality of the framework and investigates the use of MVC forms and layouts.

In Programming with Yii2: Getting Started, we set up Yii2 locally, built a Hello World application, set up a remote server, and used Github to deploy our code. This tutorial will cover some of Yii's more basic concepts related to its implementation of the MVC framework: Models, Views and Controllers. We'll also explore layouts and customization of navigation menus and Bootstrap elements.

They start with a look at the model functionality Yii2 has to offer and creates a first simple model, the "Status" model, to evaluate permission status. Next up is a simple controller, one that handles incoming status requests and either creates the record or displays the information in the model. Next is the output part of the application with examples of view handling, forms and layouts.

tagged: tutorial yii2 framework series part2 mvc form layout introduction

Link: http://code.tutsplus.com/tutorials/programming-with-yii2-exploring-mvc-forms-and-layouts--cms-22682

NetTuts.com:
Statamic 101
Dec 11, 2013 @ 16:40:41

NetTuts.com has a new tutorial posted today introducing you to Statamic, a PHP-based content management system that uses flat-files instead of database entries to manage its content. (One note, Statamic is not free software and there's no "trial" version)

Statamic is a modern PHP CMS which really makes an effort to be easy and intuitive to use. From its flat-file design to its use of technologies, like markdown and Yaml, you can accomplish an outstanding amount of work without writing any code at all. In this article we will take a look at the process from installation to setting up a basic portfolio.

The CMS (downloadable here) has a simpler structure than some other systems as most of the content is just files in the "_content" directory. They talk some about the directory structure of the tool and help you get things configured via the main YAML config. The post then moves on to working with themes and how to get dynamic content in a basic layout. From there they go on to talk about making new content, adding entries and various other topics like administration and templating.

tagged: statamic cms introduction file markdown template layout content

Link: http://net.tutsplus.com/tutorials/php/statamic-101

Andrew Podner:
Lithium: Building Views Using Layouts
Feb 13, 2013 @ 17: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.

tagged: lithium view layout tutorial framework

Link:

Constantin Bosneaga:
Using layout pattern with CodeIgniter
Oct 01, 2012 @ 16: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").

tagged: layout designpattern codeigniter tutorial library

Link:

Rob Allen:
Module specific layouts in ZF2
Sep 17, 2012 @ 15: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.

tagged: module layout zendframework2 edpmodulelayouts evancoury

Link:

Evan Coury's Blog:
Module-specific layouts in Zend Framework 2
May 11, 2012 @ 13: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.

tagged: module layout zendframework2 controller

Link:

Reddit.com:
PHP.net gets a new design. Opinions divided
Jan 25, 2012 @ 17:08:43

In this recent post on Reddit.com, there's some good discussion/feedback about the proposed redesign of PHP.net.

Opinions from commentors range widly:

  • "The layout's nice. But those colors are downright disgusting."
  • "To be honest, the new version is 100x better."
  • "It's definitely way better than the old design but still not exactly great is it?.."
  • "Much more profressional. Welcome to the 21st century PHP.net."

Have an opinion on the new layout? voice it here!

tagged: prototype opinion layout phpnet design

Link:

Joris de Wit's Blog:
Extending different layouts for Ajax requests in Twig, Symfony2
Aug 29, 2011 @ 16:39:34

Joris de Wit has a (very) quick post about a handy tip he found about switching layouts easily with Twig in his Symfony2-based application - a handy ternary sort of switch that can detect when something's an Ajax request.

I just learned about the 'app' global variable in twig. It's very handy for loading a special layout for ajax requests.

The "app" variable allows you get get back at some of the settings of your application and check on special things like the isXMLHttpRequest in his example. For more information about Twig and how you can add it to your application, check out Twig-Project.org. Using it's as simple as adding a phar.

tagged: twig symfony2 layout switch template ajax request

Link:

3 Engineers Blog:
3 Step Layouts in Zend Framework
Apr 04, 2011 @ 18: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.

tagged: zendframework twostep threestep layout wrapper view zendview zendlayout

Link:

Rob Allen's Blog:
A form in your layout
Oct 11, 2010 @ 17: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.

tagged: form layout zendframework tutorial viewhelper actionhelper

Link:


Trending Topics: