Welcome Guest, Not a member yet? Register   Sign In
form helper and HTML 4

I'm building an app using HTML 4.01 Transitional for a Doctype. Deploying forms using the Form Helper, code rendered ends with ' //>' Is there a method or something I am missing to have tags not deploy with ' //>' just a simple '>'?

There is no option to change from one to the other. I'd recommend either using an XHTML doctype so the self-closing tags are appropriate, or extend the form helper and replace / change those functions to support your variation.

@Aken or anyone

I'm relatively new to CI and OOP. Can you give me the steps to extend the form helper and modify the code so that it does not render ' />'?

There should be a way with any of the helpers to turn-off self-closing tag syntax. Further development of XHTML as a standard is not going to happen and the self-close is not necessary in HTML 5.

You could modify the core helper /system/helpers/form_helper.php and change the endings for each input.

But if you modify the core, it will be removed when you next upgrade CI.

Why not just use the html5 doctype? Or use this one that forces the most up to date doctype in your browser.

<!DOCTYPE html>
&lt;html lang="en"&gt;
&lt;meta charset="utf-8" /&gt;

Of course this assumes that your page is UTF-8 encoded and in english.

You can extend helpers rather than modify the core directly, just like controllers, models, etc.

But how, precisely? If I go the route of extending the helper, do I create a new function similar to the ones in the Helper and replace the " //>" with ">" to close the tags?


and look at the 'extending helpers' section near the bottom.



Thanks for the information. That will do nicely.

Theme © iAndrew 2016 - Forum software by © MyBB