Re: Unparsing HTML

From: Date: Tue, 20 Jun 2000 21:51:29 +0000
Subject: Re: Unparsing HTML
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-2372@lists.php.net to get a copy of this message
In article <Pine.GSO.4.10.10006151736340.20857-100000@guinness.digisle.net>, cg@digisle.net (Christian Goetze) wrote: > I'm in the process of writing the same old same old stupid code, something > like this: > > function _($tag, $attributes='', $content='') { > $html = '<'.$tag; > if (is_array($attributes)) { > while ($attribute = each($attributes)) { > if (is_int($attribute[1])) { > $html .= ' '.$attribute[0].'='.$attribute[1]; Why in the world would you want to do that?... Why not just write the HTML with the PHP embedded in it? Oh well, I guess it's kinda sorta like those "Template" things people like, so look into them. FastTemplate et al. > Now I can't imagine that I'd be the first to do this, and I'm also seeing > that this whole thing is going to end up being quite inefficient. All > these string concatenations... That's for sure. > Anyway, how come PHP doesn't have built in support for HTML (or XML) parse > trees and functions to build them, store them and dump them efficiently? There *IS* support for XML parse tree, and efficiently reading, storing, and dumping them. Check out the new XML functions. -- Richard Lynch | If this was worth $$$ to you, buy a CD US Customer Support Director | from one of the artists listed here: Zend Technologies USA | http://www.L-I-E.com/artists.htm http://www.zend.com | (this has nothing to do with Zend, duh!)

« previous php.general (#2372) next »