> Why is it good to write:
>
> <?php echo $form->end(); ?>
>
> instead of:
>
> </form>
Because the 2nd one just writes a closing form tag, whereas the 1st
performs cleanup logic (including generating security fields), and
potentially lots of other magic. It can also generate a div-surrounded
submit button automatically.
And as for $form->create(), it can auto-format the url based on the
current controller/model/action, as well as setting the enctype to
handle file uploads by setting 'type' => 'file'. It also loads the
necessary model data for displaying the fields in the correct format
and the validation errors, for use with $form->input() / inputs().
For one small form, sure, it *might* work out as more code. But in my
experience, if your application is designed consistently, its
shortcuts are invaluble and can save many many lines of code and hours
of coding / debugging / bashing heads against walls.
Still, it's just a "helper". If you don't like it, if it doesn't fit
your needs, just ignore it and type your raw html - it'll still work,
but in the long run you're making more work for yourself.
On Feb 18, 4:07 pm, leo <[EMAIL PROTECTED]> wrote:
> Why is it good to write:
>
> <?php echo $form->end(); ?>
>
> instead of:
>
> </form>
>
> How do helpers support MVC?
>
> I can't expect my designer to understand:
>
> <?php echo $form->create(null, array('url' => '/recipes/add')); ?>
>
> When I have to refer to the manual everytime I have to write it (or
> debug it). I also have problems convincing my boss that this is a
> quicker way of doing things when the output - in this case - amounts
> to 53% more typing (in the case of the first example, 285% more
> typing).
>
> L.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---