Chris Sedlmayr Real World Development

16Mar/102

Using helpers within an action in symfony

If you ever need to use a helper outside a template, you can still load a helper group from anywhere by calling

sfLoader::loadHelpers($helpers)

where $helpers is a helper group name or an array of helper group names.
For instance, if you want to use simple_format_text() in an action, you need to call

sfLoader::loadHelpers('Text');

first.

I know this is covered in the symfony docs but it's a fairly handy thing to know so thought I would make it easier to find.

Comments (2) Trackbacks (0)
  1. sfLoader is deprecated > 1.2

    Use:

    sfProjectConfiguration::getActive()->loadHelpers(array(“Text”));

  2. Yeah that’s true. Maybe I need to make It clearer this is 1.0 related.
    Cheers for commenting.


Leave a comment


No trackbacks yet.