Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7623137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:37:55+00:00 2026-05-31T04:37:55+00:00

Using the Zend Framework and the url method for the view: $this->url(array(‘field1’ => this,

  • 0

Using the Zend Framework and the url method for the view:

$this->url(array('field1' => this, 'field2' => 'is', 'field3' => 'my example'), 'route_name');

Where route_name is the name of the url route and each field# is retrieved from the database.

I noticed that by default it changes spaces in Controller/Action names into plus sign so that what looked like:

www.example.com/this is my example

to

www.example.com/this+is+my+example

I would like to change the separatoer from + to – to have something like

www.example.com/this-is-my-example

I know that another thread: How to change the separation character of Zend Url?
as documented a way to do it which I tried without success.

A thorough explanation on how to do it would be much appreciated.

EDIT2: I know where the problem lies if anyone is interested, it comes from the way the url is assemble, it uses urlencode which converts all non-alphanumeric characters expect – and _ and the spaces as +, there is no way to override that than replace the character create the url manually (as Maxime suggested) or create a custom url function replacing the characters (as suggest by aporat)…

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:37:57+00:00Added an answer on May 31, 2026 at 4:37 am

    If you really want to do that, you can extend the stock Zend_View_Helper_Url view helper and add your url logic into your view helper.

    <?php
    namespace Application\View\Helper;
    
     class MyUrl extends \Zend_View_Helper_Url
     {
        /**
         * Generates an url given the name of a route.
         *
         * @access public
         *
         * @param  array $urlOptions Options passed to the assemble method of the Route object.
         * @param  mixed $name The name of a Route to use. If null it will use the current Route
         * @param  bool $reset Whether or not to reset the route defaults with those provided
         * @return string Url for the link href attribute.
         */
         public function myUrl(array $urlOptions = array(), $name = null, $reset = false, $encode = true)
         {
    
         return str_replace('+', '-', parent::url($urlOptions, $name, $reset, $encode));
         }
    }
    

    and then just load your new view helper and you’re good to go:

            $helper = new \Application\View\Helper\MyUrl;
            $this->view->registerHelper($helper, 'myUrl');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Zend Framework and the URL View Helper to create URLs I have
I'am trying to retrieve an parameter passed in a url using the zend framework.
Note: I'm using Zend Framework, but I think most of this applies to PHP
I need some help with an url.rewrite-if-not-file. I am using a Zend Framework based
I am using a framework similar to codeIgniter and Zend FW. So URL structure
Using Zend Framework, I've created a Model to insert a record into a database.
I am using Zend Framework(MVC part of it), and need to either redirect user
I am using Zend Framework's library to manage EC2 instances and AMI. However I
I set up a Zend Framework application using Zend_Tool, but I wanted multiple modules
I have a PHP MVC application using Zend Framework. As presented in the quickstart,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.