symfonynerds.com

Nerds who love the symfony-project

Archive for May, 2009

Here at Symfony nerds we have been really excited to see the uptake of Symfony over the past few years. We thought we would create a Symfony Developers Survey.

The purpose of this survey is to see how developers across the world are using Symfony. What areas of Symfony do you focus the most ? How do you think Symfony can be improved? These are the types of questions we ask. To take the survey, click on the link below.


Take the 2009 Annual Symfony Developers Survey - Click here


All results from this survey will be published on the site, with some nice (and pretty) graphs over the next couple of weeks. Thanks!

This is a quick tip that will hopefully save you some time. The sfFormExtraPlugin is an excellent plugin with lots of extra features to help you build your forms. This tip is regarding the sfWidgetFormJQueryDate widget. This Widget lets you create a jQuery date selector. Setting up this widget is simple, but not well documented. Here are the basic steps of getting this started in your project forms:

1. Install the sfFormExtraPlugin
./symfony symfony plugin:install sfFormExtraPlugin

2. Install relevant jQuery libraries:
a) Download jQuery AND
b) Download jQueryUI

3. Setup jQuery in your project
Extract the JavaScript libs to your project js folder, then modify your app view.yml to include them:

javascripts: [jquery-1.3.2.min.js, jquery-ui-1.7.1.custom.min.js]

Note: The order in which the jQuery libs are included are important and can cause a conflict if they are not in the order above.

4. Setup the CSS for jQuery UI
When you download the jQuery UI, extract the smoothness theme into your web css directory. IE:

/web/css/smoothness

Now include the relevant CSS in your app view.yml:

stylesheets: [main, smoothness/jquery-ui-1.7.1.custom.css]

5. Setup the Widget your form class:
Note in my example below, I will have an image icon as the date selector (/images/icons/calendar_view_month.gif). This is what the form class will look like:

class myForm extends sfForm {
  public function configure()
  {
    $this->setWidgets(array(
      'from_date'    => new sfWidgetFormJQueryDate(array(
             'image'=>'/images/icons/calendar_view_month.gif', 
             'format' => '%day%/%month%/%year%')
             ),
     //...other widgets
    ));
 
    $this->widgetSchema->setLabels(array(
  		'from_date'    => 'From Date',
                //...other labels
    ));
  }
}

6. Display it in your view:
Action:

  public function executeSearch(sfWebRequest $request){    
    $this->form = new myForm();
    return sfView::SUCCESS; 
  }

View:

....
echo $form['from_date']->renderLabel().":".$form['from_date'];
....

And that’s it! You should get something looking like this:

Hope this helps.