回答編集履歴

3

変数の上書き処理追加

2016/09/25 12:19

投稿

goute
goute

スコア216

test CHANGED
@@ -20,6 +20,8 @@
20
20
 
21
21
  $builder->template('AAA_2');
22
22
 
23
+ $view = 'AAA_2'; // $view変数を上書き
24
+
23
25
  } else {
24
26
 
25
27
  $builder->template($this->request->params['action']); // これはControllerクラスにもともとあったコード

2

オーバーライドについて追記

2016/09/25 12:19

投稿

goute
goute

スコア216

test CHANGED
@@ -7,3 +7,25 @@
7
7
  $this->viewBuilder()->template("AAA_2");
8
8
 
9
9
  ```
10
+
11
+
12
+
13
+ ※追記
14
+
15
+ Controllerクラスのrender()をオーバーライド(処理はそのままコピー)して、以下のように分岐を追加すればいけるかもしれません。
16
+
17
+ ```PHP
18
+
19
+ if (条件TRUE) {
20
+
21
+ $builder->template('AAA_2');
22
+
23
+ } else {
24
+
25
+ $builder->template($this->request->params['action']); // これはControllerクラスにもともとあったコード
26
+
27
+ }
28
+
29
+ ```
30
+
31
+

1

テンプレートをご質問のものに変更しました。

2016/09/25 12:16

投稿

goute
goute

スコア216

test CHANGED
@@ -4,6 +4,6 @@
4
4
 
5
5
  ```PHP
6
6
 
7
- $this->viewBuilder()->template("detail");
7
+ $this->viewBuilder()->template("AAA_2");
8
8
 
9
9
  ```