Layouts
Layouts can be thought of as subtemplates. If you go to the home page of this site you will see that the main content is just displayed as common html. Then in this section you see that the subpages are displayed as a list with an intro and a link to view the full content. This is done with two layouts.
Default Layout

This layout just displays the page headline, content, and a module if it exists.
Tags used in this layout
- $this->pageObj->getHeadline() - loads the page headline. this will default to the page title if it is not set.
- $this->page->content - note that this does not have () after it. this is because this is a property, not a function. Generally $this->pageObj is used accessing dynamic data (like the headline that has a default). $this->page is the Zend Db Table rowset for the current page.
- $this->RenderModule() - this renders the module for the page if one is set
A More Dynamic Example
The modular data layout displays the current page's content, then a list of pages that are children of the current page (this section uses this layout).

Tags used in this layout
- $this->pageObj->getChildren() - returns a Zend Db Table Rowset of all of the current page's children.
- $this->cleanUri() - this is a view helper that cleans up the request uri. I always use this for the base of links.
- $this->pageObj->getHeadline($child) - this time we pass the getHeadline method the child row. It will return the child's headline.
- $this->TruncateText($child->content, 50) - another view helper. This truncates the text you pass it, returning the first 50 words in this case.
The DSF toolbox
The DSF toolbox is where i organize all of the little functions the app uses. There is a more detailed explanation in the developer docs, but keep these in mind.
- DSF_Toolbox_String::addHyphens($child->title) - this function replaces all of the spaces in the title with hyphens
About using php in your views
You can use any php scripts you want in your views. There are a few important things to consider:
- use the built in functionality when possible. This will ensure that when we update the core your views will still work.
- I always test my variables before i use them. if($children && count($children) > 0){ ... tests to make sure that the page has children before it tries to loop through them. While a production site should have PHP error reporting turned off it is important that your pages will validate E_STRICT.