回答編集履歴
2
class名と関数名が同じだった為、わかりやすくするため関数名変更
answer
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
```php
|
5
5
|
class HogeScriptHelper extends AppHelper {
|
6
6
|
|
7
|
-
public function
|
7
|
+
public function hogeText($selector) {
|
8
8
|
$this->_View->Html->scriptStart(array('inline' => false));
|
9
9
|
echo <<<SCRIPT
|
10
10
|
$('{$selector}').text('hoge!');
|
@@ -20,7 +20,7 @@
|
|
20
20
|
// 使用するHelperの宣言
|
21
21
|
public $helpers = array('Html');
|
22
22
|
|
23
|
-
public function
|
23
|
+
public function hogeText($selector) {
|
24
24
|
$this->Html->scriptStart(array('inline' => false));
|
25
25
|
echo <<<SCRIPT
|
26
26
|
$('{$selector}').text('hoge!');
|
@@ -32,5 +32,5 @@
|
|
32
32
|
|
33
33
|
上記のHelperを作成してViewにて
|
34
34
|
```php
|
35
|
-
$this->HogeScript->
|
35
|
+
$this->HogeScript->hogeText('.hoge');
|
36
36
|
```
|
1
コード修正
answer
CHANGED
@@ -32,5 +32,5 @@
|
|
32
32
|
|
33
33
|
上記のHelperを作成してViewにて
|
34
34
|
```php
|
35
|
-
$this->HogeScript->hogeScript();
|
35
|
+
$this->HogeScript->hogeScript('.hoge');
|
36
36
|
```
|