Code snippets for symfony 1.x


Refine Tags

Snippets tagged "helpers"

Use helpers from specific modules..

If you have come across the need to use a helper that is from another module, with this function you can do so by specifying the helper in this format "my_module/HelperName". If you do not specify a module, it will look in the current module name.

function my_use_helper()
  $args = func_get_args();
  foreach($args AS $arg)
    if( strstr($arg, '/') )
      $moduleName = substr($arg, 0, strpos($arg, '/'));
      $helper = substr($arg, strpos($arg, '/') + 1, strlen($arg));
    } else {
      $moduleName = sfContext::getInstance()->getModuleName();
      $helper = $arg;
    sfLoader::loadHelpers(array($helper), $moduleName);
// Usage
by Jonathan Wage on 2007-04-24, tagged helpers  module