[dokuwiki] Re: how to add dynamic css from a plugin ?

  • From: Christopher Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Wed, 19 Mar 2008 18:15:39 +0000


On 19 Mar 2008, at 17:05, Stéphane Gully wrote:

However I have a last problem. What I want is both a syntax and an
action plugin:
- An action plugin because I have to insert dynamic css and js in the
HTML headers.
- A syntax plugin because I have to parse the typed wiki text to find
a special pattern, then I extract some data from it and I generate an
output.
The problem is that action.php cannot generate the html headers before
syntax.php because the css/js are calculated from the typed wiki text.

This is a bit weird. Is there a solution ?

Not withstanding Andi's point that it might not be necessary, there is a solution.

The solution depends on understanding dokuwiki's process, in particular
- caching
- rendering formats
- metadata

If you don't immediately know what I am talking about, review the documentation on each of the above at wiki.splitbrain.org.

- render important information for your JS/CSS using the metadata renderer not xhtml renderer. Its now stored in the page's metadata where its accessible before just about everything DW does. - have your action plugin check the page's metadata for that key information and then use it to generate the JS/CSS where it can be added to the TPL_METAHEADER_OUTPUT data. - check how caching impacts on what you are trying to do. You want to write stable information into the metadata so that caching will have no impact on it and your page. The action plugin can be responsible for generating uncacheable information.

- Chris--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: