Actually,
it turns out, it was a lot of over thinking. You don't need to extend or
create a new view helper URL at all.
This is all you have to do:
1. In your action script, pass the parameters to your view script so you can
use them (maybe there's a way of accessing them in your view script t
Good catch, but if you reset the parameters, you'll lose the ones that
weren't explicitly passed in. Maybe the answer is to extend the router so
you can customize its assemble method?
--
*Hector Virgen*
Sr. Web Developer
Walt Disney Parks and Resorts Online
http://www.virgentech.com
On Wed, Oct
Yes you are right.
I got it to work but there was one "gotcha". I needed to set the "reset"
parameter to true, to let the parameters to sort properly.
This is the view helper I created (basically a copy/paste of the actual view
helper URL class, you can, of course, just extend as Hector did)
ht
I just ran a quick test using a simple route, and my assumption was correct
-- the wildcard params keep the order that was supplied:
echo $view->url(array('foo' => 'bar', 'derp' => 'doo'));
// /index/index/foo/bar/derp/doo
echo $view->url(array('derp' => 'doo', 'foo' => 'bar'));
// /index/index/d
Named parameters (such as "module", "controller" and "action" in the
"default" route) should not be affected by the ksort, but anything that is
handled by "*" should (in your case, the name1 and name2 keys). Again, I
didn't test the code, but if it doesn't work that way I'd be surprised.
--
*Hecto
Hi Hector,
Thanks for the tip about helpers.
One item of note, ksorting doesn't actually do anything when passing it to:
"$router->assemble($urlOptions, $name, $reset, $encode);"
If that doesn't make sense, here's the thing, the URL helper code is simply
this:
$router = Zend_Controller_Fr
There's an easier way to extend the existing Url view helper. Since view
helpers are loaded using a LIFO stack, you can create your own view helper
named "url" and Zend_View will use that one instead of the built-in version.
I suggest extending the existing helper instead of copying it. That way yo
As a follow up to myself,
I've found that the View Helper "Url()" works pretty well, with one
exception, I so far haven't found if it is capable of sorting parameters
alphabetically by the "name" column.
ie: "/[module]/controller/action/name1/value1/name2/value2"
Where name1 is always alphabeti