Tuesday, April 19, 2011

Symfony Load Helper in Action

Symfony provides a rich set of methods in View part of Symfony MVC, which by defualt are not available in Action part, to make this available you have to load the specific helper that have your desire method, for example if you want to use image_path() method of Symfony you will need to load 'Assest' Helper, or if you want to use url_for() method you will load 'Url' helper, a complete list of helpers and there respective methods is available here

Now, Let the code talk

if i want to use image_path() method i will do it like this,
// ...
// may some code here...
// ...

sfContext::getInstance()
      ->getConfiguration()
        ->loadHelpers("Asset");

// this will load Symfony Asset Helper.. and make available all its helper.

$imagePath=image_path("../uploads/profile_images/IMAGE_NAME");

// ...
// more code...
// ...

0 comments:

Post a Comment

 

Blog Info

A Pakistani Website by Originative Systems

Total Pageviews

Tutorial Jinni Copyright © 2015 WoodMag is Modified by Originative Systems