2010-10-26 117 views
1

我有我的路由配置如下:Zend框架路線ini文件鏈接

routes.rooms.type = "Zend_Controller_Router_Route_Static" 
routes.rooms.route = "/rooms" 
routes.rooms.defaults.module = "rooms" 
routes.rooms.defaults.controller = "index" 
routes.rooms.defaults.action = "index" 

routes.rooms.chains.room.type = "Zend_Controller_Router_Route_Regex" 
routes.rooms.chains.room.route = "/(\d+)" 
routes.rooms.chains.room.defaults.action = "room" 
routes.rooms.chains.room.map.1 = "room_id" 
routes.rooms.chains.room.reverse = "/%d" 

;admin 
routes.rooms.chains.admin.type = "Zend_Controller_Router_Route_Static" 
routes.rooms.chains.admin.route = "/admin" 
routes.rooms.chains.admin.defaults.controller = "admin" 
routes.rooms.chains.admin.defaults.action = "index" 

routes.rooms.chains.admin.chains.deletedrooms.type = "Zend_Controller_Router_Route_Regex" 
routes.rooms.chains.admin.chains.deletedrooms.route = "/deletedRooms(?:/(\d+))?" 
routes.rooms.chains.admin.chains.deletedrooms.defaults.action = "deletedrooms" 
routes.rooms.chains.admin.chains.deletedrooms.map.1 = "page_id" 
routes.rooms.chains.admin.chains.deletedrooms.defaults.1 = 1 
routes.rooms.chains.admin.chains.deletedrooms.reverse = "/deletedRooms/%d" 

一切似乎罰款的路線,但試圖使用路由(電流試圖用客房構建導航菜單時-admin)該頁面什麼都不顯示(空白頁面,沒有錯誤)。如果我刪除路由,則說明路由的錯誤消息尚未定義;說得通。

如果我評論出房間管理員,稍後的路線'房間管理員刪除房間'工作正常..所以它似乎房間管理是問題。

我見過這個:How do I write Routing Chains for a Subdomain in Zend Framework in a routing INI file?但我不想使用hostname部分,我希望我的路由相對於默認路由系統(使更改將花費太長時間)。任何可能導致此錯誤的想法是否正確定義了路線?

在附註上,有什麼更快的解析:ini或xml?我猜php陣列是所有選項中最快的方法。

回答

0

不確定你的鏈接問題,但我對解析你的配置的問題有一個建議。在APC中緩存生成的配置,因爲它只是一個數組。

<?php 
... 
/** Zend_Application */ 
require_once 'Zend/Application.php'; 

// Use default application.ini config the first time 
// then pull the php array from apc 
$config_file = APPLICATION_PATH . '/configs/application.ini'; 
$config_cached = false; 
if (apc_exists('application.ini')) { 
    $config_file = apc_fetch('application.ini'); 
    $config_cached = true; 
} 

// Create application, bootstrap, and run 
$application = new Zend_Application(
    APPLICATION_ENV, 
    $config_file 
); 

// cache the application.ini config if this is staging or production 
if (!$config_cached && ('development' != APPLICATION_ENV)) { 
    apc_add('application.ini', $application->getOptions()); 
} 

參考:http://www.hellotecho.com/cache-your-zend-framework-config-to-improve-performance