Troubleshooting CakePHP

I’m just starting to learn CakePHP 1.2 and I am running in to small little problems. As I find solutions I write them down so people after me might have an easier time finding them.

Problem:

Warning (512): Method HtmlHelper::file does not exist
Warning (512): Method HtmlHelper::submit does not exist

Solution:

Those methods have been moved to the FormHelper in Cake 1.2. So you have to add the FormHelper to the $helpers array of your controller, and to use $form instead of $html. But I am not sure whether you have to modify other things in this example to make it work with Cake 1.2. I have to test it myself.

Example:

// Bad
echo $html->file(‘File’);
echo $html->submit(‘Upload’);

// Good
echo $form->file(‘File’);
echo $form->submit(‘Upload’);

No Comments.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>