Cakephp routes prefix

前端 未结 2 1662
春和景丽
春和景丽 2021-01-28 14:06

I have 3 diferent layouts for my application related to diferent parts of content. I vould like to define my url-s so they would have the part in the begining ex. \"mypage.com/p

2条回答
  •  独厮守ぢ
    2021-01-28 14:31

    It's very easy to integrate multiple prefix with routing in cakephp

    In cakephp 2.x you have to go through following steps

    1. go to the app/Config/core.php and add following lines Configure::write('Routing.prefixes', array('admin','manager'));
    2. Now you have to write the routing for this go to the app/Config/routes.php add following lines
    3. Router::connect("admin/:controller",array('action'=>'index','admin'=>true));
    4. Router::connect("admin/:controller/:action/*",array('admin'=>true));
    5. Router::connect("manager/:controller",array('action'=>'index','manager'=>true));
    6. Router::connect("manager/:controller/:action",array('manager'=>true));

    For more info refer following link http://book.cakephp.org/2.0/en/development/routing.html http://miftyisbored.com/complete-tutorial-admin-routing-cakephp/

提交回复
热议问题