As suggested on TaviSuggestions this is a page for discussing/debating the topic of plug-ins. When talking about a plugin I refer to dumping a given file into a given directory, where 'Tavi automatically will be able to use the given plugin. No need for changing other files, just add the file and off you go.

Pros

Cons

A scheme like this lends itself easy to implement stuff like TaviPatches/ChessBoard, TaviPatches/LocalImages, TaviPatches/HTMLExport.

And if, for some reason, formatting rules should change, one could easily make a plugin which upgraded old rules. I.e. a plugin to fix the soon to be extinct %%Pagename%% syntax.

Syntax on use of a plugin

Today we have a special macro for TaviCategories, [[! ]], and I'm thinking along the same line, so maybe something like [[& PlugInName options to plugin ]]. And then when 'Tavi sees that on this particular page someone wants PlugInName it could include a file aptly named, $PlugInName.php, which contains functions with names where PlugInName is prefixed as not to interfere with the other functions. See TaviSuggestions/PlugInsExample.

Do you like it?

Add comments, thoughts and questions here, and lets see what the community thinks of such an extension to 'Tavi.

Plugins, to me at least, are very much where I tend to bust out classes in PHP... WorldMaker

I've got 4 questions: --AaronLaw

  1. What is Macro? (What Macro does in Tavi?)
    • If you're referring to URL's like ...action=macro&macro=PageRefs, then those are internal references to how the the TaviMacros are called
  2. What is the difference between Macro and Plugins in Tavi?
    • A macro, in this scheme, is an action/plugin which is delivered as default part of 'Tavi. In other words one might say that TaviMacros are internal macros, whilst /PlugIns would be a kind of external macros.
  3. Is Plugins in tavi equals to Action in Wakka(which is a php script put into "action" direction to add new features to Wakka...e.g. Wakka does not support category in officially. However, I can put a php script named "category.php" under a directory called "action" to let Wakka know how to categories pages) ?
    • This does sound like something similar to plugins, yes. But I don't know how Wakka would access those extra utilities. In 'Tavi they would only be called when the text of a page contains a reference to a plugin.
  4. What is the directory "action" in tavi does?
    • See note above; "action" is not a directory it's a part of a reference to the internal macros.
Thanks. --AaronLaw

A suggestion

If I understand this right, if we put a [[@ PluginName? options to the plugin]] call on a page, "Tavi would go to the plugin directory, try to load a PluginName?.php file and call the PluginName?_main() function passing it the options (if any).

What if I make some complex stuff and need more than one file (classes, config file and so on)?

What I would suggest is this. When "Tavi encounters a plugin call, it goes to the plugin directory and search for the plugin file. If it doesn't find it, it then tries to find a PluginName? subdirectory. If it finds one, it then load the PluginName?.php file.

This would let people do some really complex things.

Thanks : --LouisLapointe