leela Posted September 8, 2011 Share Posted September 8, 2011 Hi, I am having the issue regarding ROUTER .I am able to route index but not other actions .. If i comment the route code for index , then in url http://localhost/postblog/public/p/add can be able to go to add ..... why both index and add actions are not working at the same time.. we use 1.11 version My Files routes.ini [production] ;routes.login.type = "Zend_Controller_Router_Route" ; ----------------- USER ROUTING ----------------- routes.post.route = "/p/:action/*" routes.post.defaults.module = "Post" routes.post.defaults.controller = "posts" routes.post.defaults.action="index" routes.post.route = "/p/add" routes.post.defaults.module = "Post" routes.post.defaults.controller = "posts" routes.post.defaults.action = "add" [staging : production] [testing : production] [development : production] bootstrap.php <?php class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { public function init() { //Start session } protected function _initDoctype() { $this->bootstrap('view'); $view=$this->getResource('view'); $view->doctype('XHTML1_STRICT'); } protected function _initAutoload() { $aModules = array( 'Post' ); foreach ($aModules as $module) { $loader = new Zend_Application_Module_Autoloader( array( 'namespace' => $module, 'basePath' => APPLICATION_PATH . '/modules/'.$module, )); $loader->addResourceType('form', 'forms', 'Form') ->addResourceType('controller', 'controllers', 'Controller') ->addResourceType('model', 'models', 'Model') ->addResourceType('dbtable', 'models/DbTable', 'Model_DbTable') ; } } protected function _initRoutes() { /** * Set Routing */ $routeConfig = new Zend_Config_Ini("../application/configs/routes.ini", APPLICATION_ENV); //TODO: Get environment from Apache config or environment variable $router = new Zend_Controller_Router_Rewrite(); Zend_Controller_Front::getInstance()->getRouter()->addConfig($routeConfig, 'routes'); } /*protected function _initPlugins() { $this->bootstrap('FrontController'); $front = $this->getResource('FrontController'); * * Register plugins * The alternative way is that put plugin to /application/config/application.ini: * resources.frontController.plugins.pluginName = "Plugin_Class" $front->registerPlugin(new Etg_Controller_Plugin_Init()); } */ } ?> my Application.ini [production] phpSettings.display_startup_errors = 0 phpSettings.display_errors = 0 includePaths.library = APPLICATION_PATH "/../library" bootstrap.path = APPLICATION_PATH "/Bootstrap.php" bootstrap.class = "Bootstrap" appnamespace = "Application" resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" resources.frontController.params.displayExceptions = 0 resources.view[] = resources.db.adapter = PDO_MYSQL resources.db.params.host = localhost resources.db.params.username = root resources.db.params.password = root resources.db.params.dbname = zendblog resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/" resources.modules[]="" resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" [staging : production] [testing : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 [development : production] phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 resources.frontController.params.displayExceptions = 1 Thanks for ur help, Leela Quote Link to comment https://forums.phpfreaks.com/topic/246748-routing-in-zend-framework/ Share on other sites More sharing options...
Cagecrawler Posted September 10, 2011 Share Posted September 10, 2011 Your routes both have the same name (post) and are overwriting each other. Quote Link to comment https://forums.phpfreaks.com/topic/246748-routing-in-zend-framework/#findComment-1267566 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.