Textpattern [1] is a gamma release CMS/blog tool which uses XML templating very effectively -- and I can't see an easy way to reproduce this with straight PHP.
<txp:foo a='cat' b='dog' c='mouse'>something</txt:foo> might translate to the following PHP code:
<?=tag_foo(array('a'=>'cat','b'=>'dog','c'=>'mouse'),'something'); ?> OR
<?=tag_foo('cat','dog','mouse','something'); ?>
Easy enough, except this is where the XHTML wins:
For the PHP versions, the template designer must have an in-depth knowledge of the functions. He/she must get the parameters in the right order, know which ones have default values, etc etc. Making a mistake will generate errors and break code.
The XHTML version on the other hand doesn't ask any more or less of the designer than XHTML does. I can switch the order of the arguments, leave some out, etc etc, leaving the hard work to the PHP function on the other end to sort it all out.
So, my question is:
Am I missing something in regards to PHP's functions that would give us some more simplicity? The closest I can think of is to pass the attributes in any order using 'attr=value', then using funct_get_args() to sort it all out:
<?=tag_foo('b=dog','a=cat','content=something','c=mouse')?>
But this is STILL less intuitive than: <txp:foo b='dog' a='cat' c='mouse'>something</txt:foo>
Any ideas? John????
--- Justin French http://indent.com.au
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php