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 232555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:01:39+00:00 2026-05-11T20:01:39+00:00

This question is linked to this one How can I set the default of

  • 0

This question is linked to this one

How can I set the default of the category part to be the category value in the request url?

$Router=$this->_front->getRouter();
$CategoryRoute = new Zend_Controller_Router_Route('category/:category/:controller/:action/*',
           array(
                 'controller' => 'index',
                 'action'     => 'index',
                 'category'   => 'aaa'
           ));
$Router->addRoute('category', $CategoryRoute);

In other words, I need the value [aaa] to be the value of category in the time I am building this route. There will always be a value for [category] as otherwise it will use the default route.

Example of what I mean:
If I surf to the site with url http://baseurl/category/mycat/index
I will be routed to controller=index, action=index, category=mycat.
But, in all my view files, where I use the Zend_View::url() helper, the links will point to:
http://baseurl/category/aaa/somthing/somthing (Using the exact route from above)
While I actually need them to point to:
http://baseurl/category/mycat/somthing/somthing

This happens because the default value for category is written as a constant in the route, and not taken, somehow, from the current URL.
I currently solve this by extracting by myself the category from the URL and making it the default.

  • 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-11T20:01:39+00:00Added an answer on May 11, 2026 at 8:01 pm

    Is there a question in your post? 🙂

    IF I got you right – yousetup your default category and it will be used if you call

    $this->url(array(),'category');
    

    But when you use

    $this->url(array('category'=>'my-category'),'category');
    

    it will return category/my-category/index/idnex instead of category/aaa/index/index

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

Sidebar

Related Questions

Question similar to this: select from two tables where linked column can be null
I was reading the linked question which leads me to ask this question. Consider
This is linked to a question I asked yesterday. Briefly, the problem I'm having
This is linked to my other question when to move from a spreadsheet to
This question is similar in concept to this one , except I see I
How can I set the classpath of one third-party JAR to include a second
I've been pondering this question for a while: Can you build a faster fundamental
This question has been asked several times here, but I can't find answer for
This is a question posed to me in an interview. A single linked list
I have question quite much related to this one I asked a while ago

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.