2011-11-07 2 views
1

나는 '계정'이라는 템플릿이있는 계정 컨트롤러가 있습니다. 나는 로그인/잊어 버린 암호 작업에 대해 다른 템플릿을 지정하는 방법을 알아 내려고하고 있습니다.조치 수준에서 다른 Kohana 템플릿 렌더링

+1

우리가 생각을 가질 수있는 모든 코드 : 컨트롤러 before 방법, 당신은 그 기반으로 템플릿을 작업의 이름을 확인하고 변경할 수 있을까? Controller_Template이나 콧수염보기를 사용하고 있는지 또는 한 문장의 내용이 무엇인지는 알 수 없습니다. – Darsstar

+0

좋은 질문입니다. 왜 그것은 뉘앙스가 떨어 졌습니까? 나는 똑같은 문제를 겪고 있었고 @ david-winter의 답은 나를 도왔다. (Kohana 3.3.1에서 테스트했다.) – Ivan

답변

5

컨트롤러가 확장되어 있다고 가정합니다. Controller_Template?

<?php 

class Controller_Account extends Controller_Template { 

    // This is the default template used for all actions 
    public $template = 'account'; 

    public function before() 
    { 
     // You can add actions to this array that will then use a different template 
     if (in_array($this->request->action(), array('login', 'forgot_password'))) 
     { 
      $this->template = 'diff_template'; 
     } 

     parent::before(); 
    } 
+1

그 덕분에 - 감사합니다! –

+0

나는 Kohana 3.3.1에서 이것을 테스트했다. grest. 감사. Upvoted. – Ivan

관련 문제