1. Introduction
    1. About Agavi
    2. MVC in Agavi
    3. Overview of Agavi
    4. Overview of Application Execution Flow
    5. A Word About Actions
    6. Application filesystem layout
    7. Overview of application configuration
  2. Setting Up The Initial Application
    1. Installing Agavi
    2. Creating an Agavi Project
    3. Finishing The Setup
    4. Finishing The Basic Setup
    5. Installing a New Copy of Your Application
  3. Adding First Code
    1. Creating A New module
    2. Creating A New Action
    3. Tying Things Together — An Introduction To Routing
    4. Fixing The Bloggie Routing
    5. Accessing Request Parameters and Validation Basics
    6. Handling Validation Errors
  4. Putting The M in MVC
    1. Creating A New Model
    2. Adapting The Actions and Views
    3. Custom Validators
  5. Polishing It Up
    1. Layers and Layouts
    2. Applying Our Layout
    3. What Are Slots?
    4. Adding The Post's Title To The URL
    5. Routing Callbacks
    6. Using Callbacks for the Title in URLs
  6. Connecting to a database
    1. The Database Manager
  7. Handling Output Variants
    1. Output Types
    2. Exception Templates
    3. Generating an RSS Feed
  8. Form Processing
    1. Adding a Post
    2. Editing a Post
    3. The Form Population Filter (FPF)
  9. Creating a User Authentication System
  10. Adding To The Master Template

Polishing It Up

Now that we have the basics working just fine, we should do some polishing. We'd like the title of the post to be displayed in the URL to make our friends from the Search Engine Optimisation (SEO) department happy and we'll make the whole blog look a little better. Let's start with the looks.

You might have noticed that our templates consisted of only the most basic html code needed to display the list or respectively the post. However, when you looked at the page there was a title tag that we were able to manipulate through a template variable and the page title was also set. If you had a look at the HTML source you'd have noticed that it is indeed valid xhtml. How did that happen?

Old style PHP applications often made use of included snippets of HTML code, often called header and footer. Those were included in the templates to factor out common html code. Agavi has a mechanism to factor out common code but it works far better than using includes. It's called layers. When we created the application using the Agavi build script a very basic set of layers was created and configured for us. In the following chapter we'll go through those to understand what this is all about.

We'll be using the open source Emplode template by Arcsin, which can be obtained from the resources/template/ directory of this tutorial or from http://templates.arcsin.se/emplode-website-template/. The result of this chapter is the http://www.agavi.org/guide/stages/stage4.tgz application.