Open-Source PHP Framework - Designed for rapid development of performance-oriented scalable applications

Default layout

API >> mvc >> layouts >> default
The default layout is meant as a starting point for most applications and is meant to be used as it is after adding your site design features to it.

HTML Headers

The default layout is configured to pass the $head variable to the header() HTML helper, this allows you to set from your controller or view the title, meta keywords and meta description as well as any other valid header() parameter. A typical page would set in either the controller or view:
get::$title 'My Page'
get::$meta = array('keywords' => 'keyword, another keyword, etc''description' => 'Description here...');

Note: since a title is required on every page by W3 HTML standards, if get::$title is unset the SITE_NAME constant will be used (this is set in the .config file.)


The default layout is preconfigured for both a static and animated favicon, just add your icon files to your .webroot. To turn off favicons comment out the lines setting $head['favicon'] and/or $head['animatedFavicon'].
Note: your favicon must be named "favicon.ico" or "favicon.gif", otherwise you will need to update the filenames in the default layout.


The default layout has a special $alert variable that when set will output above your view content and have the errormessage(s) CSS class applied to it. If you are only concerned with displaying one message at a time you can set alert to a string, this would always display the last message set; if you would like that all messages are displayed you can add alerts as array elements, this would essentially duplicate the flash functionality of Ruby on Rails. Eg. from your controller:
Displaying only a single alert
$return['alert'] = 'Your form data was submitted incomplete'

Displaying multiple alerts
$return['alert'][] = 'Your form data was submitted incomplete'
$return['alert'][] = 'Email address is invalid'
$return['alert'][] = 'There is no such zip code in the state of New York'

Google Analytics

To have Google Analytics log every page on your site you can add your Analytics ID to the argument of $html->footer(), eg:
echo $html->footer(array('GoogleAnalytics' => 'UA-12345678-9'))

Internet Explorer 8 compatibility mode

For convenience you can activate the IE8 IE7-compatibility mode by uncommenting the line:
$head['metaheader']['X-UA-Compatible'] = 'IE=EmulateIE7';

Printable CSS and other CSS media types

For printable CSS add a "printable.css" file to /webroot/css and uncomment the line:
$head['head'][] = $html->css('/css/print.css?1''print');
For other media types simply add additional CSS files and change the print argument to the media type of the file (handheld, projection, etc.) Leaving out the second argument will default to the CSS all type (suitable for all devices.)