[wp-hackers] Templatedia, a new work in progress plugin

Viper007Bond viper at viper007bond.com
Thu Aug 30 22:44:58 GMT 2007


You can't use this in the actual theme files (use include() for that). This
is strictly for actual post/page content, hence the add_filter().

An example usage:

You have a bunch of plugins you've written and a page for each. You want to
have a color/styled box on each plugin's page that has a fancy icon, says
what the latest version is, and has a download link. Well, rather than
duplicating the HTML into each post, you use this plugin and make a
template, such as this (we'll call it "downloadbox"):

<div
style="background-color:yellow;width:300px;text-align:center;float:right;"><img
src="/foo/bar/file.png" alt="File" /><br /><br />Latest Version: <a href="
http://site.com/files/{{file}}">{{version|Download}}</a></div>

Then you would just put this into your post/page:

{{downloadbox|file=plugin.zip|version=1.2.6}}

or even this to just display "Download" for the link:

{{downloadbox|file=plugin.zip}}

Follow? :)

On 8/30/07, Computer Guru <computerguru at neosmart.net> wrote:
>
> Nice idea, that's for sure :-)
>
> Can "template elements" be used from within posts as well? Or only in
> the theme php?
>
> Wasn't there a plugin a while back for adding Smarty to WP? Anyone
> know what happened to it?
>
> On 8/30/07, Viper007Bond <viper at viper007bond.com> wrote:
> > I was bored the other day, in the mood to code, and surfing when it
> occurred
> > to me that Wikipedia / MediaWiki's template system would work well as a
> > template system for posts. For example, a box that says "download this
> > plugin" with a fancy icon and all that. You could simply do
> > {{downloadbox|file.zip}} and it'd put the box's HTML there along with
> the
> > right link.
> >
> > So, partially as a coding challenge to myself but as well as to develop
> a
> > plugin I figured some people might get some use out of, I present you
> all my
> > new plugin: Templatedia
> >
> > At 100 lines of code, it's a lot simpler than I expected it to be, but
> then
> > again it has no user interface yet and is still missing some advanced
> > template abilities that the original MediaWiki format has.
> >
> > If you'd like to check out what I have so far, I've pastebin'ed it:
> > http://wp-hackers.pastebin.com/f3c38ad72
> >
> > Be warned -- it may not the best way to go about doing this feature. I
> came
> > up with it from scratch and didn't use anything as a basis in terms of
> code.
> > I'm also really inexperienced when it comes to regex, so no laughing
> please.
> > :P
> >
> > Feature suggestions and comments are welcome, especially at this early
> stage
> > when it's still easy to change things. ;)
> >
> > --
> > Viper007Bond | http://www.viper007bond.com/
> > _______________________________________________
> > 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/
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Viper007Bond | http://www.viper007bond.com/


More information about the wp-hackers mailing list