It would be good to have a function hook in the standard templates to allow plugins to add functions (links and buttons).
At the moment I don't know of a simple way to do this. Maybe there is, and all that's needed is a documentation fix.
From a plugin author's perspective, I don't care where the buttons I add appear; that should be up to the skin. But I want to be able to add the kinds of functions:
- Forms processed by Javascript, such as a form to specify an action to be added to the textarea on the edit screen
- Buttons above, below, left and right of the edit text pane (htmlarea style)
- Bottom bar links (view screen)
A reasonable starting point would be a hook in the view and edit templates, such as %PLUGINHOOK%, that was available for plugins to process.
Oh heck, do plugins ever get to see the templates before they are emitted....??
--
CrawfordCurrie - 11 Oct 2004
Maybe there should be a
%PLUGINTEMPLATE{...}% variable that would insert custom template stuff for all plugins that want to insert content in the template at a specific location.
prefixing each location with the template name you could have:
-
%PLUGINTEMPLATE{editTextAreaAbove}%
-
%PLUGINTEMPLATE{editTextAreaBelow}%
-
%PLUGINTEMPLATE{editTextAreaLeft}%
-
%PLUGINTEMPLATE{editTextAreaRight}%
-
%PLUGINTEMPLATE{twikiLinks}% - for inserting links in the <head> section to Javascript and CSS files
-
%PLUGINTEMPLATE{twikiLinks}%
-
%PLUGINTEMPLATE{viewLinks}%
-
%PLUGINTEMPLATE{rdiffLinks}% - This would be useful for linking to css to hide CommentPlugin input boxes that have been deleted in the topic.
Maybe this would be a way to do user stylesheet inclusion?
One thing I'd like to see this used for is user javascript inclusion so that a users custom javascript is only linked if that user is viewing the page, and not if someone else views the users home topic,
which is how the current
PatternSkin CSS works.
Take a look at my home topic and you should see the nav bar on the right.
This is acceptable for
CSS, if annoying, but wouldn't be very secure for JavaScript.
--
SamHasler - 11 Oct 2004