[wp-hackers] Do I have to suggest a new hook (or just write
better documentation)?
Computer Guru
computerguru at neosmart.net
Sun Sep 9 18:22:18 GMT 2007
There's something very interesting that vBulletin and some other
systems do: global theme string variables.
Basically its a list of every string you'd encounter, propogated with
the defaults for English. It's theme independant, you plugins can add
their own variables to the list.
It doesn't require a full-fledged theming engine, I think it just runs
all the PHP templates through a state machine or a regex converter
that does what's needed.
It's a lot easier to say:
'Go to WP-Admin, Select Theme Variables, and change "foo" to "bar"'
than
'Load the template modification page in the WP dashboard. Open the
template "single.php" for the theme you want to use. Go through the
billions of lines of code and find something that just *might* maybe
look possibly somewhat like "foo" and change it to "foo %25bar%" then
hit the save button. If you fsck everything up, FTP into your server
and replace it with the stock file from your theme and rinse and
repeat.'
As far as coding is concerned, it's really no biggie. It doesn't
require a real theme engine, it doesn't take much on theme developers
behalf (and simplifies quite a bit, replacing the billions of
print_f() with %varname%), etc.
And even once you use a variable-based system you won't even *need* to
ask the users to change anything, because you can use a simple hook or
two to change the contents of the variables automatically.
It would be backwards-compatible with the old theme system (since the
only difference is, technically, a new hook in the form of %varname%)
.
The only issue for consideration is performance. Assuming the variable
map is stored in the database, you'd probably need a
performance-efficient (read-only?) way of accessing it, such as a
mysql MEMORY table.
Of course all this could be just mad ravings, but I think it has
potential and could help address some of these issues and then
some................................................
Just my two cents,
CG
On 9/9/07, Alex Günsche <ag.ml2007 at zirona.com> wrote:
> On Sun, 2007-09-09 at 12:59 +0200, Pixline wrote:
> > I wrote a plugin [1] that needs a little template modification in
> > order to work. But I have seen in the last two months that quite 9/10
> > of potential users have troubles in doing this little modification [2].
> > As long as I know, there's no hook available to make what this plugin
> > is supposed to do (replace 'archive for category x' h2 with a page
> > content, like a longer introduction to your category archives).
>
> I'm very familiar with the problem that users are unable or unwilling to
> do certain modifications to their templates. But if it is a template
> issue, there's no way around it.
>
> The problem in your case is that this text "archive for ..." does vary
> very much across themes. Some themes will have similar phrase, others
> are translated, some may even lack that section.
>
> Yes, you could replace the section (as already proposed) by buffering
> and regexing, but you will not be able to solve this automatically *and*
> in a clean manner.
>
> As for a hook, what sort of hook should that be? There are only very few
> and generic hooks in the templates (like wp_head, wp_meta, wp_footer),
> and with good reasons. A hook to print a single, template-related
> section doesn't make sense.
>
> I'm afraid you and your users will have to live with the necessity of
> editing the template files.
>
> Alex
>
>
> --
> Alex Günsche, Zirona OpenSource-Consulting
> Blogs: http://www.zirona.com/ | http://www.regularimpressions.net
> PubKey for this address: http://www.zirona.com/misc/ag.ml2007.asc
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
--
Computer Guru
Director,
NeoSmart Technologies
http://neosmart.net/blog/
More information about the wp-hackers
mailing list