[Typo3-dev] TYPO3 and XHTML
Sebastian Roth
sebastian.roth at gmail.com
Wed May 11 02:15:14 CEST 2005
Hi,
On 5/9/05, Sven Wilhelm <wilhelm at icecrash.com> wrote:
> on the oo-way it could be a nice class img.
> no hacks but a clean reusable way.
hm. Creating 20+ classes for each possible html-Element is overkill
imho. We then also run into problems when some html elements really
getting deprecated / are not available in the current doctype.
What about creating some kind of TagManager class?
$e = new html::Element( 'img' );
$e->addAttribute('height',$height);
$e->print( );
Meaning that there is a static array containing
- all possible html elements
- all possible attributes to them
- some kind of callback functions to run when a element gets updated
(useful with img, e.g. when the src attribute will be set, the
callback function gets a reference to the tag-object & adds
appropriate height/width attributes)
Adding attributes via the constructor would be also interesting to
save some method calls.
IMHO the oop way sounds nice, but makes the entire system big[tm].
Using if/else/sprintf/echo is still faster than creating an object for
something trivial like an html element.
Seb.
More information about the TYPO3-dev
mailing list