[wp-hackers] A template tag proposal

Brian Meidell brian at mindflow.dk
Tue Jul 27 20:17:57 UTC 2004


The alternative could be using the easytags code I've made with the same 
functions, but where they return all of them.

Instead of writing:
<?php the_author() ?>
you could write
<wp:author> or <wp:the_author>

If we had a consistent the_ naming convention, we could even use 
<wp:author>. All future calls conforming to this naming pattern would 
work automatically work with easytags, and the added benefit is that 
every single function exists as a returning function as well. Double 
functionality, no clutter.

Easytags only works with returning functions because of the fact that 
it's impossible (at least according to my attempts) to use the echoing 
functions in a ob_start callback.

EasyTags: http://meidell.dk/blog/files/easytags.phps
It's short, sweet and the tags can be made as user friendly as you could 
want, while the programmers get their returning functions.

Just an idea.

/Brian

Kitty wrote:

>One thing that should be done, is to break out all the functions that
>echo values and put them into 'functions-template-tags.php'.
>
>Then, everything that is in it, would become an "official" template tag
>could be conformed to a (proposed) standard:
>- a prefix of "the_"
>- will work 95% of the time w/o params being passed.
>- when params are needed, they're URL style
>- echos by default, can be overridden ('echo=false').
>- only echos/returns strings.
>
>This could become the "public interface" to WP and simplify life for the
>casual blog builder w/o taking away any flexibility. Since a majority of
>the existing template tag functions are in this ballpark, the breakage
>would be minor, and easily fixed.
>
>I've backtracked from originally saying that all functions should
>return, not echo. Because this discussion pointed out that users want
>template tags, and devs want returns. And have a standard template tag
>interface would be best for users.
>
>Also publishing a standard like this would make life easier for plugin
>users. They would know that everything works in a similar way when a
>plugin provides a template tag. (Providing that the plugin authors
>followed the standard.)
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>hackers mailing list
>hackers at wordpress.org
>http://wordpress.org/mailman/listinfo/hackers_wordpress.org
>  
>



More information about the hackers mailing list