drResponseTitlePlugin - 1.0.0

Response title plugin

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to the Plugins Home


Forgot your password?
Create an account



advanced search
Information Readme Dependencies Releases Changelog Contribute
Show source


The drResponseTitlePlugin takes care of the response title and provides methods for adding parts to the response title from several places in your application. This way you can combine several title parts into one title, separated by for example a dash:

Site name - News - New plugin released

By default the plugin reverses the order of the title parts, which is better with SEO in mind:

New plugin released - News - Site name


Open the file /config/ProjectConfiguration.class.php and enable the plugin:

class ProjectConfiguration extends sfProjectConfiguration
  public function setup()


When enabled, the plugin provides a title holder for the response. From several places you can add parts to the response title or reset it.

In your actions, add title parts to the title holder:

class newsActions extends sfActions
  public function preExecute()
  public function executeShow(sfWebRequest $request)
    $this->news = $this->getRoute()->getObject();
    $title_part = $this->news->getTitle();

In your layout, call the helper function to render the <title> tag and it's contents (place this call inside the <head> tag):


The helper function also excepts a number of (optional) parameters, to separate title parts by a specific string

include_composed_title(' | ');

To render the title parts in reverse order:

include_composed_title(' | ', true);

To also include or exclude the existing response title, set the third argument to true or false respectively:

include_composed_title(' | ', true, true);


You may change the default separator (' - ') in advance:

sfContext::getInstance()->getResponse()->getTitleHolder()->setSeparator(' | ');

Or you may set the render order to normal (instead of reverse):