【发布时间】:2011-10-24 19:54:08
【问题描述】:
我正在做一个小项目——网站。有画廊、用户登录、商店和许多小的文本部分——有图像和没有图像。 例如,我想制作漂亮的网址:
Gallery -> /eng/gallery (GalleryController::index)
Gallery album /eng/gallery/album_name_slug (GalleryController::view)
Shop -> /eng/products (ProductsController::index)
Shop one product -> /eng/products/product_name_slug (ProductsController::view)
所有其他(文本)页面都转到“PagesController”,但没有 /pages/view 前缀
Contacts -> /eng/contacts
About us -> /eng/about_us
我认为我可以制作这样的东西:
// Homepage
Router::connect('/', array('controller' => 'homepage', 'action' => 'display'));
/* There delegate routes for each controller/method (gallery, shop, etc) */
// All what is not in thease controllers/methods goes to pagescontroller
Router::connect('/*', array('controller' => 'pages', 'action' => 'view'));
在 routes.php 中制作它的最佳方法是什么?也许你可以举一些通用的例子?
谢谢!
【问题讨论】:
-
我认为您的路线没有任何问题。什么不工作?
-
我想知道是否有可能,让这个工作,而不是委托所有功能(产品/画廊)路线,只有全部?
-
“委托所有功能路由”是什么意思?
-
嗯...我的问题很糟糕。无论如何,谢谢!