Results 1 to 3 of 3

Thread: 'Route default is not defined' Using Custom routes.ini File

  1. #1
    gregl83 is offline Junior Member
    Join Date
    Jul 2010
    Posts
    19

    Default 'Route default is not defined' Using Custom routes.ini File

    Ok, ok, ok. I'm not trying to make a new record for most latest posts on zfforum. I just keep search for questions that don't have an easy answer somerwhere. So hopefully asking here will help someone else out...

    I have a custom routes.ini file setup. I removed all the routing in zend, because I only want my specefic routes to have access.

    Errors route normally and so do my custom routes. Everything works fine until I try to use the helper redirector tool.

    Code:
    $this->_helper->redirector('index', 'index');
    This producs the following error:
    Message: Route default is not defined

    My routes.ini file has been trimmed down to show the basic format:
    Code:
    [production]
    routes.main.type = "Zend_Controller_Router_Route_Static"
    routes.main.route = "/"
    routes.main.defaults.controller = "index"
    routes.main.defaults.action = "index"
    yada yada yada

    I called this routes.ini config file in my boostrap file with the following function:
    Code:
    protected function _initRouter(){
      $config = new Zend_Config_Ini('routes.ini', 'production');
      $front = Zend_Controller_Front::getInstance();
      $router = $front->getRouter();
      $router->removeDefaultRoutes();
      $router->addConfig($config, 'routes');
    }
    Not that complicated and quite useful if you ask me.

    So, how do I define a default route using this method? Or, simply make this error not appear anymore?

    Thanks in advance

  2. #2
    alokin is offline Senior Member
    Join Date
    Apr 2009
    Posts
    211

    Default

    When you use redirector helper that way, it will try use default route, which you previously removed ($router->removeDefaultRoutes()), so you should use gotoRoute() method, for example:
    Code:
    $this->_helper->redirector->gotoRoute(array(), 'main', true);

  3. #3
    gregl83 is offline Junior Member
    Join Date
    Jul 2010
    Posts
    19

    Default

    ok... thanks.

    for now i just started using the $this->_redirect method

Similar Threads

  1. Undocumented option 'route', route untranslated content phrases to default language
    By tueschej in forum Internationalization (i18n) & Localization (l10n)
    Replies: 3
    Last Post: 07-18-2010, 01:53 PM
  2. [Zend 1.8][Zend_route] Language param defined in route ?
    By Lopimp in forum Core Infrastructure
    Replies: 1
    Last Post: 11-03-2009, 01:44 PM
  3. Replies: 2
    Last Post: 10-07-2009, 08:38 AM
  4. No default module defined for this application
    By alexdicix in forum Model-View-Controller (MVC)
    Replies: 0
    Last Post: 09-04-2009, 08:27 AM
  5. Form defined by INI file, how to remove a decorator?
    By hastinbe in forum Core Infrastructure
    Replies: 3
    Last Post: 09-19-2008, 05:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •