Or instead of a configuration file, we can also configure it directly in the base class:
class sfProjectHelper extends sfHelper { public function configure() { // with a configuration file // done automatically by the parent class if the file exists $this->loadYaml('helpers.yml'); // override or create a new helper group $this->setHelperClass('url', 'sfUrlHelper'); } } -- Fabien Potencier Sensio CEO - symfony lead developer sensiolabs.com | symfony-project.com | aide-de-camp.org Tél: +33 1 40 99 80 80 Bernhard Schussek wrote: >> <?php $url = $helper->get('url') ?> >> >> And a configuration file where you define the binding between 'url' and >> a class >> >> url: sfUrlHelper > > +1 for this approach > > > Bernhard > > On Thu, Jul 3, 2008 at 2:27 PM, Fabien Potencier > <[EMAIL PROTECTED]> wrote: >> Tristan Rivoallan wrote: >>> On Thu, Jul 3, 2008 at 11:00 AM, Bernhard Schussek <[EMAIL PROTECTED]> >>> wrote: >>>> I don't like the $h idea. It's complicated to understand for new >>>> developers, the extra squared brackets and quotes add unnecessary >>>> complexity and are prone to errors and last but not least, the array >>>> syntax is totally misused. >>>> >>>> IMO we should opt for the most simple, but most obvious solution: By >>>> simply defining the objects in the template. >>>> >>>> <?php $Url = new sfUrlHelper ?> >>> you are right, this solution is better. There's not much difference between >>> >>> <?php load_helper('url') ?> >>> >>> and >>> >>> <?php $url = new sfUrlHelper() ?> >>> >>> the only issue i see is that if you override the sfUrlHelper, you have >>> to change the instanciation in every template. >> What about: >> >> <?php $url = sfHelper::get('url') ?> >> >> or >> >> <?php $url = get_helper('url') ?> >> >> or better >> >> <?php $url = $helper->get('url') ?> >> >> And a configuration file where you define the binding between 'url' and >> a class >> >> url: sfUrlHelper >> >> The $helper->get() has the advantage to be able to change the $helper >> base class and to keep in this base class some common objects >> (sfRouting, ...) >> >> Fabien >> >>> ++ >>> tristan >>> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to symfony-devs@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en -~----------~----~----~----~------~----~------~--~---