improved plugin template

Improved plugin template for Textpattern:

http://vigilant.tv/documents/tp/zem_tpl.php.txt

Features:

  • Help text is now in Textile format
  • No need to escape quotes in your code
  • Plugin code syntax will be checked at compile time

Since the code is now inline, rather than an escaped string, it will be displayed correctly by syntax-highlighting editors.

Use it as you would the old template: copy the file to abc_myplugin.php, edit the appropriate sections, and run it at the command line or load it in a browser to compile.

Instructions are in the file. Author name, URL and plugin version are set as per the old template. Help text and code are placed between ”—- BEGIN” and ”—- END” tags. Textile will automatically be used to process the help text if classTextile.php is found in the PHP include path.

Great Idea. I’m surprised no one did this sooner.

ramanan    Sep 1, 09:48 am    #

Zem, are you going to update this for the new format?

Dean Allen    Sep 26, 08:42 pm    #

Dean,

I haven’t updated it yet because there are still plenty of people using older releases. Though I haven’t been watching closely, I don’t think the new format is in wide use yet.

zem    Oct 4, 07:10 am    #

How does this stand with the version of the plug-in template that Dean has posted at the forums?

Has this yet been updated for the new format as Dean mentioned?

Eric    Nov 20, 07:51 pm    #

Holy cow, I wish I’d seen this sooner. I’ve been getting really adept at using the ampersand codes for greater than and less than for the help text and doing global search and replace for ’ in vi. And hating every minute of it. Bless you bless you bless you.

And in other news, is this alternate format why I have not been able to cut and paste plugin code into the text box as of RC1? It always gives me an “Unrecognized format” error.

Mark (Remillard)    Dec 1, 12:24 am    #

Mark,

You can install old style plugins in RC1 by copying and pasting the base64 encoded text within the quotes, e.g. $plugin='thisbitistheplugin';

Alex    Dec 22, 04:05 am    #

Holy crap, Alex – I don’t know why I never came across this earlier. Makes plugin development soooo much easier. Thanks!

andrew    Mar 14, 06:58 am    #

Hey zem – are you still using this template for distributing your plugins? I notice here on your site you’re linking to files w/ a .txt. file extension.

The reason I ask is because I’ve noticed that if you use this template and try to download the plugin in Firefox/Mac that it just returns a “blank” page (I say “blank” because if you view source you can grab the plugin text but for the common user it just appears like a dead link).

Are you using some mime type jiggery-pokery or rewriting – or have you just gone to saving the output as a text file?

andrew    Apr 1, 03:11 pm    #

404’d.

Vexeffexx    Oct 12, 05:09 am    #

Commenting is closed for this article.