Welcome Guest, Not a member yet? Register   Sign In
The Ultimate HTML tags generator
#1

[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/0...extension/

i hope to get some reviews Big Grin
#2

[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.
#3

[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 ?




Theme © iAndrew 2016 - Forum software by © MyBB