2013-04-18 69 views
1

我試圖讓zfcuser路由到我的模塊的根目錄。 我的意思是我嘗試刪除「/用戶/登錄...?」,取而代之的是「/登錄...?」 這裏是重命名根方式:http://juriansluiman.nl/en/article/117/use-3rd-party-modules-in-zend-framework-2ZfcUser替換路由

我試圖設置「 /「路由爲zfcuser,但它不起作用(bjyauthorizestrategy發送異常)。 我如何路線zfcuser兒童得到我在找什麼?答案

+0

可能的重複http://stackoverflow.com/questions/15494787/disable-default-zfcuser-routes?rq=1 – Crisp

+0

你是真實的它不是那麼遠,這不是我正在尋找的答案。我找到了解決方案,但我現在不能回答我自己的帖子... – Angus

回答

3

部分: https://github.com/ZF-Commons/ZfcUser/issues/202

完整的答案: 現在我在module.config.php代碼如下所示:

'zfcuser' => array(
      'type' => 'Zend\Mvc\Router\Http\Literal', 
      'options' => array(
       'route' => '', // the route is void isntead of default 'user' 
      ), 
    ), 
    'zfcuser-login' => array(
     'type' => 'Literal', 
     'options' => array(
      'route' => '/login', 
      'defaults' => array(
       'controller' => 'zfcuser', 
       'action' => 'login', 
      ), 
     ), 
    ), 
    'zfcuser-authenticate' => array(
     'type' => 'Literal', 
     'options' => array(
      'route' => '/authenticate', 
      'defaults' => array(
       'controller' => 'zfcuser', 
       'action' => 'authenticate', 
      ), 
     ), 
    ), 
    'zfcuser-logout' => array(
     'type' => 'Literal', 
     'options' => array(
      'route' => '/logout', 
      'defaults' => array(
       'controller' => 'zfcuser', 
       'action'  => 'logout', 
      ), 
     ), 
    ), 
    'zfcuser-register' => array(
     'type' => 'Literal', 
     'options' => array(
      'route' => '/register', 
      'defaults' => array(
       'controller' => 'zfcuser', 
       'action'  => 'register', 
      ), 
     ), 
    ), 
    'zfcuser-changepassword' => array(
     'type' => 'Literal', 
     'options' => array(
      'route' => '/change-password', 
      'defaults' => array(
       'controller' => 'zfcuser', 
       'action'  => 'changepassword', 
      ), 
     ),       
    ), 
    'zfcuser-changeemail' => array(
     'type' => 'Literal', 
     'options' => array(
      'route' => '/change-email', 
      'defaults' => array(
       'controller' => 'zfcuser', 
       'action' => 'changeemail', 
      ), 
     ),       
    ), 

我也希望用於登錄/註冊自定義模板等於是我把這個:

'view_manager' => array( 
    ... 
    'template_path_stack' => array(
      // to load our module view 
      'YOURMODULENAME' => __DIR__ . '/../view', // zfcuser have to load after 
      your module in your application.config.php !!! 
    ), 

我希望這將是有益的;)