From: Arthaey A. <ar...@gm...> - 2004-06-29 09:16:09
|
So I've been looking at existing plugins and trying to learn how to make them. Here I'm trying to make a simple stub warning plugin. Here's the run function from my plugin/Stub.php: function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); $html = HTML::div(); $html->pushContent("This page is a "); $html->pushContent(LinkURL(WikiURL("StubPage"))); $html->pushContent(". You can help the wiki by "); $html->pushContent(LinkURL( WikiURL($args['pagename'], array('action' => 'edit')), "editing it")); $html->pushContent(". Until then, it will be filed under "); $html->pushContent(LinkURL(WikiURL("CategoryStub"))); $html->pushContent("."); return HTML::em($html); } It displays almost perfectly (http://arthaey.mine.nu:8080/wiki/index.php/Ashyinave), with the exception that the LinkURLs are class='namedurl' instead of 'wiki'. This makes it so that the BackLinks plugin on the CategoryStub page doesn't see the pages with the stub link. I tried changing it from $html->pushContent(LinkURL(WikiURL("CategoryStub"))); to $link = LinkURL(WikiURL("CategoryStub")); $link->setAttr('class', 'wiki'); $html->pushContent($link); But the class remained as 'namedurl'. So I have two questions: 1. Why doesn't the setAttr call work like I expected it to? 2. Is there some better way of doing this altogether? Thanks! -- AA |