I'm working on a plugin that programmatically creates headers (via TransformText("!Header")). Because the text of the header isn't in the wiki page's source, the following won't work: <?plugin CreateToc ?> <?plugin MyPlugin ?> A comment in Template.php says that there is CreateToc support if I pass the parsed markup to the plugin as $dbi->_markup. I tried grepping for an existing plugin that uses _markup like this, but I found nothing. Without an example, I'm confused about the specific syntax of getting this call to work. Here's my best guess: In MyPlugin.php: function run($dbi, $argstr, &$request, $basepage) { $html = HTML(); $toc = new WikiPlugin_CreateToc(); $content = $this->_generateMyContentAndHeaders(); $html->pushContent($toc->run($dbi, "", $request, $basepage)); $html->pushContent($content); return $html; } Alas, this gives me an error says I "cannot instantiate non-existent class wikiplugin_createtoc." Changing it from WikiPlugin_CreateToc to just CreateToc gives me the same error. How do I get an instance of CreateToc to run programmatically, and how to I pass it the proper data? Thanks! -- AA
> I'm working on a plugin that programmatically creates headers (via > TransformText("!Header")). Because the text of the header isn't in the > wiki page's source, the following won't work: > > <?plugin CreateToc ?> > <?plugin MyPlugin ?> > > A comment in Template.php says that there is CreateToc support if I pass > the parsed markup to the plugin as $dbi->_markup. I tried > grepping for an existing plugin that uses _markup like this, but I found > nothing. There's only CreateToc so far. > Without an example, I'm confused about the specific syntax of > getting this call to work. Here's my best guess: > > In MyPlugin.php: > > function run($dbi, $argstr, &$request, $basepage) { > $html = HTML(); require_once("lib/plugin/CreateToc.php"): > $toc = new WikiPlugin_CreateToc(); > $content = $this->_generateMyContentAndHeaders(); > $html->pushContent($toc->run($dbi, "", $request, $basepage)); > $html->pushContent($content); > return $html; > } > > Alas, this gives me an error says I "cannot instantiate non-existent > class wikiplugin_createtoc." Changing it from WikiPlugin_CreateToc to > just CreateToc gives me the same error. > > How do I get an instance of CreateToc to run programmatically, and how > to I pass it the proper data? -- Reini Urban http://xarch.tu-graz.ac.at/~rurban/