CodeIgniter Forums
xhtml-ending Tag in Helpers - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: xhtml-ending Tag in Helpers (/showthread.php?tid=65415)



xhtml-ending Tag in Helpers - basenic - 06-09-2016

Hello,
is there a possibility to insert helper-tags without the xhtml ending-tag "/>"?
Like a switch to toggle this behaviour?

Best regards.


RE: xhtml-ending Tag in Helpers - ciadmin - 06-09-2016

Hmmm - I am not aware of such a tag in any of the CI helpers.
Can you give an example of one of these?


RE: xhtml-ending Tag in Helpers - basenic - 06-09-2016

For example in the file "html_helper.php" the "meta"-function returns the meta-tag with "/>".
Also the returned fields in "form_helper.php".


RE: xhtml-ending Tag in Helpers - ciadmin - 06-09-2016

Now your reference makes sense Smile No, there is no way to toggle that in stock CI.

You could over-ride the functionality by creating application/helpers/MY_html_helper and MY_form_helper, and providing replacement functions for the ones you want to behave differently. See http://www.codeigniter.com/user_guide/general/helpers.html#extending-helpers


RE: xhtml-ending Tag in Helpers - ivantcholakov - 06-09-2016

@basenic

Why?


RE: xhtml-ending Tag in Helpers - rtenny - 06-09-2016

(06-09-2016, 01:21 AM)basenic Wrote: Hello,
is there a possibility to insert helper-tags without the xhtml ending-tag "/>"?
Like a switch to toggle this behaviour?

Best regards.

Why would you even want to do this? In HTML you should close empty tags as well.
Get into the habit of writing well formed code. It will help you a lot in the long run.


RE: xhtml-ending Tag in Helpers - InsiteFX - 06-09-2016

In html 5 they removed the ending tag /> to just > it does not matter either way it will still work.


RE: xhtml-ending Tag in Helpers - basenic - 06-09-2016

Oh...thats a bummer. As InsiteFX already wrote, we are only coding in HTML5 anymore. There are no closing slash-tag. Same for HTML4 (not xhtml).

Does anybody know if such an option is considered for CI4?