Mariano is presenting about creating a complete website with a framework. Specifically Mariano will be talking the CakeFest site. This should help to show how to apply the theories that have been talked about up to today and throughout the rest of the week. cakefest.org was developed for the first Cakefest, it is multi-user, multi-event, multi-language application, that was needed to scale for mulitple events. It was built with Themes, Behaviors, pagination, security, Acl, Auth and i18n.
Using themes to 'reskin' a site
Themes are set by using Controller::$view = 'Theme';
and setting Controller::$theme = 'themeName'
. The theme views allow you to override specific views and leave others as they are in the core application. In the CakeFest site the theme was tied to a url parameter. This allowed search engines to crawl and consume all of the content. A cookie would not allow that.
Behaviors
Behaviors were used to reduce and abstract much of the model code. Behaviors allow you to reuse code not only between models in this application but others as well. Mariano provided an example with the tokenaable behavior used in resetting passwords.
Security
You can use security to stop form manipulation, and force actions to only accept specific HTTP requests. For example using requireGet('login')
will not allow a POST or any other request type other than GET to login. Security component automatically secures all forms built with form helper. A hash key is added to each form, and if the hash key doesn't match after post, the request is sent to a blackHole. Using the security component is an easy way to keep forms secure and safe.
Email Component
Email component was used to send emails from the CakeFest site. It used templates and attachments which are both native to the EmailComponent.
RSS and RequestHandler
By using RequestHandler and Router::parseExtensions()
we don't need to add a separate action for the RSS and non RSS versions of the news listings. With this approach we also use a separate view file for the RSS format. Another benefit is that we are not required to set the headers manually or switch the layout. This helps to save time and effort, as the layout switching and header content types are generated automatically.