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

  • Home
  • SEARCH
  • 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 8971713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:01:34+00:00 2026-06-15T18:01:34+00:00

Hello I am using ZendFramework 2.0 and I would like to set routing with

  • 0

Hello I am using ZendFramework 2.0 and I would like to set routing with query params. For example I would like something like that to get working.

I want route that will match …/foo?my_param=number but will not
match …/foo or …/foo?not_allowed_param=value

'type' => 'Literal',
'options' => array(
    'route' => 'foo',
    'defaults' => ...// Route to some error handler
    'may_terminate' => true,
    'child_routes' => array(
        'query' => array(
             // there is some query so route to my action
            'type' => 'Query',
            'options' => array(
                'defaults' => array(
                    'controller' => 'index',
                    'action' => 'fooAction',
                ),
            ),
        ),
    ),
),

On the other side I want be able to use $this->url(‘…/foo’, array(‘my_param’ => 3))

Ofc that this does not work. I hope you get the idea what behaviour I expect.

Thanks for any help!

  • 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-06-15T18:01:36+00:00Added an answer on June 15, 2026 at 6:01 pm

    Your answer suggests use of GET parameters. You could check in the controller if the variables have been passed.

    If you want to do it through the router (as Sam notes) you can set up a segment style router. This is explained at this link:
    http://framework.zend.com/manual/2.0/en/modules/zend.mvc.routing.html

    An example of how this could look is included below:

    'YourName' => array(
                'type' => 'segment',
                'options' => array(
                    'route' => '/property/search[/:action]',
                    'constraints' => array(
                        'controller'=>'[a-zA-Z][a-zA-Z0-9_-]*',            
                        'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                    ),
                    'defaults' => array(
                        'controller' => 'Module\Controller\Controller',
                        'action' => 'index',
                    ),
                ),
            ),
    

    Segments in square brackets are considered optional.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Example: www.site.com/index.php#hello Using jQuery, I want to put the value hello in a variable:
Hello i am using Zend Framework Form and have tried to get this example
Hello I am using OpenLayers, and I would like make zoom map to show
How to write a simple bittorrent application. Something like a hello world using a
Hello Im using HTTParty to call for a remote json file that I need
Lets say I have something like this uid tag 1 HeLLo 2 heLLO 3
Hello iam using wordpress and i need to set permission for a plugin folder
Would it be possible to print Hello twice using single condition ? if condition
I'm just trying to compile the hello world example of boost.python WITHOUT using all
So I have a a text file that looks something like this: public >ret

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.