Note that there are some explanatory texts on larger screens.

plurals
  1. POCakePHP - TinyMceHelper helper error: Method TinyMceHelper::__name does not exist
    primarykey
    data
    text
    <p>So I'm wanting to implement the TinyMce helper. I've followed instructions from the cakephp bakery but am still getting a error. </p> <p>This is the helpers array in my project controller:</p> <pre><code>var $helpers = array('Form', 'Time', 'Crumb', 'Text', 'Tinymce'); </code></pre> <p>This is the tinymce helper I downloaded:</p> <pre><code>&lt;?php class TinyMceHelper extends AppHelper { // Take advantage of other helpers var $helpers = array('Javascript', 'Form'); // Check if the tiny_mce.js file has been added or not var $_script = false; /** * Adds the tiny_mce.js file and constructs the options * * @param string $fieldName Name of a field, like this "Modelname.fieldname", "Modelname/fieldname" is deprecated * @param array $tinyoptions Array of TinyMCE attributes for this textarea * @return string JavaScript code to initialise the TinyMCE area */ function _build($fieldName, $tinyoptions = array()) { if (!$this-&gt;_script) { // We don't want to add this every time, it's only needed once $this-&gt;_script = true; $this-&gt;Javascript-&gt;link('/js/tiny_mce/tiny_mce.js', false); } // Ties the options to the field $tinyoptions['mode'] = 'exact'; $tinyoptions['elements'] = $this-&gt;__name($fieldName); return $this-&gt;Javascript-&gt;codeBlock('tinyMCE.init(' . $this-&gt;Javascript-&gt;object($tinyoptions) . ');'); } /** * Creates a TinyMCE textarea. * * @param string $fieldName Name of a field, like this "Modelname.fieldname", "Modelname/fieldname" is deprecated * @param array $options Array of HTML attributes. * @param array $tinyoptions Array of TinyMCE attributes for this textarea * @return string An HTML textarea element with TinyMCE */ function textarea($fieldName, $options = array(), $tinyoptions = array()) { return $this-&gt;Form-&gt;textarea($fieldName, $options) . $this-&gt;_build($fieldName, $tinyoptions); } /** * Creates a TinyMCE textarea. * * @param string $fieldName Name of a field, like this "Modelname.fieldname", "Modelname/fieldname" is deprecated * @param array $options Array of HTML attributes. * @param array $tinyoptions Array of TinyMCE attributes for this textarea * @return string An HTML textarea element with TinyMCE */ function input($fieldName, $options = array(), $tinyoptions = array()) { $options['type'] = 'textarea'; return $this-&gt;Form-&gt;input($fieldName, $options) . $this-&gt;_build($fieldName, $tinyoptions); } } ?&gt; </code></pre> <p>And this my add view that I want to use the helper on:</p> <pre><code>&lt;?php echo $form-&gt;create('Project'); echo $form-&gt;input('title', array('label' =&gt; 'Title')); echo $form-&gt;input('website', array('label' =&gt; 'Website')); echo $tinymce-&gt;input('description'); echo $form-&gt;input('language_id', array('label' =&gt; 'Language')); echo $form-&gt;input('tags', array('type' =&gt; 'text')); echo $form-&gt;end('Post project'); ?&gt; </code></pre> <p>Everything looks alright but I'm getting this error:</p> <pre><code>Warning (512): Method TinyMceHelper::__name does not exist [CORE/cake/libs/view/helper.php, line 154] </code></pre> <p>Think I'm missing a step here?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload