[wp-hackers] Easytags template system
Tom Armitage
tom.armitage at gmail.com
Wed May 10 16:21:51 GMT 2006
> Example code from my sidebar:
> <?php get_linksbyname('Reading', '<li>', '</li>', '', FALSE, 'rand',
> FALSE, FALSE, 12, FALSE); ?>
> How can that be done by a template tag? Unless somewhere else you want
> me to edit those preferences into a tag and in such case the tag becomes
> as much an obstacle as the original code.
OK, so template tags CAN have parameters. To crib from MT, here's some
pseudo-markup:
<$getlinks name="Reading" before="<li>" after="</li>" order="random"$>
The overhead for translating that to your php is minimal. And, you'll
notice, it's more characters. It's also more immediately
understandable - the attribute AND value are in the tag. I hate having
to remember what all the parameters are for each wp function as it
stands :)
So it's not necessarily about making everything into single-word tags.
MT, like Blogger before it, puts attributes into its tags to alter
default values.
By displaying attributes within the tag, it becomes self-documenting,
more immediately hackable for a new user, or and old user who's
forgotten the order parameters go in. And, of course, in a tag like
that, the order of parameters should be irrelevant :)
More information about the wp-hackers
mailing list