Awesome, cheers!

Matthew Weier O'Phinney wrote:
-- Jack Sleight <[EMAIL PROTECTED]> wrote
(on Thursday, 01 November 2007, 07:07 AM -0700):
First, in your regex above, I'd also store the matched language in the
registry so you can retrieve it later:

    Zend_Registry::set('language', $matches[1]);

I'd create your own Url helper extending Zend_View_Helper_Url, and have
it prepend the string with the language:

class My_View_Helper_Url extends Zend_View_Helper_Url {
        public function url(array $urlOptions = array(), $name = null, $reset = 
false)
        {
            $url = parent::url($urlOptions, $name, $reset);
            if (Zend_Registry::isRegistered('language')) {
                $url = '/' . Zend_Registry::get('language') . $url;
            }

            return $url;
        }
    }

Then, simply register the path to this helper in your bootstrap or a
plugin:

    $view->addHelperPath('/path/to/My/View/Helper', 'My_View_Helper');

When you call on the 'url' helper later, it will find yours as it will
have been registered later, which means you won't need to change your
view scripts. :-)


--
Jack

Reply via email to