CodeIgniter Forums
The Ultimate HTML tags generator - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: The Ultimate HTML tags generator (/showthread.php?tid=27866)



The Ultimate HTML tags generator - El Forum - 02-22-2010

[eluser]Blaze Boy[/eluser]
i have wrote an article about tag(), it's a function that generates HTML, and here is the introduction:
Quote:If we want to generate HTML using controller or even view files we can do that in two ways:

Use the HTML helper :
it’s some functions that generate unordered list, anchors, images…etc
Write the HTML directly in your files (bad practice).
The 1st way is really better but it leaks something? What if we want to generate HTML for an array, add attributes, and make any tag we want.

The second way can do it but:

If you write <h1></h1>, and you want to change the h1 to div? You have to change it in 2 places, right?

What if you HTML are nested tags? You’ll be in a total maze of your code.

The rest of article+code On my blog :
http://www.blazeboy.com/wordpress/2010/02/22/html-generator-the-ultimate-codeigniter-extension/

i hope to get some reviews Big Grin


The Ultimate HTML tags generator - El Forum - 02-23-2010

[eluser]jeffpeck[/eluser]
That's very clever. It reminds of the Scriptaculous Builder class where you can nest elements and have it build them, although much nicer to implement something like this on the server side when possible. It is nice that you can set an initial indent. I did not check closely, but it seems that it would produce very neat HTML.


The Ultimate HTML tags generator - El Forum - 02-23-2010

[eluser]Blaze Boy[/eluser]
if you have any ideas for accelerating or addition please tell me,
i want some regular expression to extract class name and ID from selector, any ideas ?