小智 5
我假设您的控制器已延长Controller_Template?在controllers before方法中,您可以检查操作的名称并根据以下内容更改模板:
<?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();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1261 次 |
| 最近记录: |