teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

class名と関数名が同じだった為、わかりやすくするため関数名変更

2016/11/04 04:35

投稿

ShoheiTai
ShoheiTai

スコア911

answer CHANGED
@@ -4,7 +4,7 @@
4
4
  ```php
5
5
  class HogeScriptHelper extends AppHelper {
6
6
 
7
- public function hogeScript($selector) {
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 hogeScript($selector) {
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->hogeScript('.hoge');
35
+ $this->HogeScript->hogeText('.hoge');
36
36
  ```

1

コード修正

2016/11/04 04:35

投稿

ShoheiTai
ShoheiTai

スコア911

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
  ```