Troubleshooting CakePHP

less than 1 minute read

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');

Leave a comment