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 you
can ksort the $urlOptions array before passing it to the parent method.

Here's a quick example (not tested):

http://pastie.org/1235792

The added benefit is that you don't have to decide which helper to use in
your view scripts -- just use the same call $this->url() and pass in "true"
as the fifth parameter.

I hope this helps!

--
*Hector Virgen*
Sr. Web Developer
Walt Disney Parks and Resorts Online
http://www.virgentech.com



On Wed, Oct 20, 2010 at 9:11 AM, Fozzyuw <jmbertu...@gmail.com> wrote:

>
> 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 alphabetically sorted compared to name2.
>
> I'll have to dig through the router code to see if there's an option that
> can be set to do this, but I might simply create a custom view helper
> called
> "UrlAdvanced" that does this instead (due to time considerations).
>
> This View Helper can be easy to make.  Simply take the current View Helper
> URL, copy it and rename appropriately to "UrlAdvanced" and change the
> "Zend_" part of the "Zend_View_Helper" to whatever namespace you use on
> your
> site.
>
> Then, in the main method, I will simply add an option to allow the
> parameters to be sorted.
>
> This will require taking all the page parameters, sorting them, and then
> re-submitting them with the reset parameter set.  Or something like that.
>
> I'll try this out and post my solution/code once I've completed it.
>
> Fozzy
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Generating-URL-s-View-Helper-Action-Helper-tp3002936p3004178.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>

Reply via email to