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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:21:16+00:00 2026-06-01T03:21:16+00:00

I’m building a Zend Framework 1.11.11 application and would like to make the routes

  • 0

I’m building a Zend Framework 1.11.11 application and would like to make the routes and content database driven.

I’ve written a FrontController Plugin that retrieves the ‘paths’ from the database and creates an entry in the Router for each one, with the associated controller and action.

However, I’d like to be able to use ‘aliases’ – a URL that behaves like a normal URL, but is an alias.

For example, if I create the following:

// Create the Zend Route
$entry = new Zend_Controller_Router_Route_Static(
    $route->getUrl(), // The string/url to match
    array('controller'  => $route->getControllers()->getName(),
            'action'    => $route->getActions()->getName())
);                    
// Add the route to the router
$router->addRoute($route->getUrl(), $entry); 

Then a route for /about/ for example can goto the staticController, indexAction.

However, what’s the best way for me to create an alias of this route? So if I went to /abt/ it would render the same Controller and Action?

To me it doesn’t make sense to recreate the same route as I’ll be using the route as the page ‘identifier’ to then load content from the database for the page…

  • 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-01T03:21:18+00:00Added an answer on June 1, 2026 at 3:21 am

    you can extend static router:

    class My_Route_ArrayStatic extends Zend_Controller_Router_Route_Static
    {
        protected $_routes = array();
    
        /**
         * Prepares the array of routes for mapping
         * first route in array will become primary, all others
         * aliases
         * 
         * @param array $routes array of routes
         * @param array $defaults 
         */
        public function __construct(array $routes, $defaults = array())
        {
            $this->_routes = $routes;
            $route = reset($routes);
            parent::__construct($route, $defaults);
        }
    
        /**
         * Matches a user submitted path with a previously specified array of routes
         * 
         * @param string $path
         * @param boolean $partial
         * @return array|false 
         */
        public function match($path, $partial = false)
        {
            $return = false;
    
            foreach ($this->_routes as $route) {
                $this->setRoute($route);
                $success = parent::match($path, $partial);
                if (false !== $success) {
                    $return = $success;
                    break;
                }
            }
    
            $this->setRoute(reset($this->_routes));
            return $return;
        }
    
        public function setRoute($route)
        {
            $this->_route = trim($route, '/');
        }
    }
    

    and add new router this way:

    $r = My_Route_ArrayStatic(array('about', 'abt'), $defaults);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to run a str_replace or preg_replace which looks for certain words
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
Let's say I'm outputting a post title and in our database, it's Hello Y’all
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to count the length of a string with PHP. The string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:
We're building an app, our first using Rails 3, and we're having to build

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.