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

[eluser]dwlamb[/eluser]
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 '>'?
#2

[eluser]Aken[/eluser]
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.
#3

[eluser]dwlamb[/eluser]
@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.
#4

[eluser]bluemonsta[/eluser]
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.

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

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

[eluser]CroNiX[/eluser]
You can extend helpers rather than modify the core directly, just like controllers, models, etc.
#6

[eluser]dwlamb[/eluser]
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?
#7

[eluser]bluemonsta[/eluser]
http://ellislab.com/codeigniter/user-gui...lpers.html

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

[eluser]InsiteFX[/eluser]
./application/helpers/MY_name_helper.php
#9

[eluser]dwlamb[/eluser]
@bluemonsta

Thanks for the information. That will do nicely.




Theme © iAndrew 2016 - Forum software by © MyBB