Symfony Resources Central

Web development made simple

Don't be fooled by awkward view.yml js/css positionning syntax!

Short post today about advanced view.yml configuration (in symfony 1.0, and 1.1) for assets.

You can give additional options to "javascripts:" and "stylesheets:" sections, but the sin equa non condition is to know about the yet very un-documented view.yml assets syntax.

So here it is:

  javascripts: [ jquery: { position: first } ]
  stylesheets: [ mycss: { position: last, media: screen } ]

I don't know if there are others options like thoose available, but taken the 'position' attribute apart, which is extracted to become the $position method argument of sfWebResponse::addJavascript() and ::addStylesheet, any other option is passed in the $options array.

Methods prototypes below:

class sfWebResponse ...
{
  /* ... */
  public function addJavascript($js, $position = '', $options = array());
  public function addStylesheet($css, $position = '', $options = array());
  /* ... */
}

sfGeshi plugin

sfGeshi's aim is a symfony plugin that integrates the Generic Syntax Highlighter PHP library (GeSHi) into the Symfony Framework. Supports 75 different languages, and you can add more by writing simple php files.

Related links:

© Copyright 2007-2008 daKrazy. All rights reserved.

Design and template by hartym