From: Carsten K. <car...@us...> - 2002-11-19 05:41:52
|
Hi Loyd, Yes the HelloWorld plugin comments are a little vague and out of date, the returned value should now use the HTML class functions not raw strings. Try something like this: $MOTD = "One moon shows in every pool;\nIn every pool, the one moon."; $MOTD = explode("\n", htmlentities($MOTD)); // make an array to walk through later $html = HTML(); // new HTML object foreach ($MOTD as $line) $html->pushContent($line, HTML::br()); // add each line to the html object $html->unshiftContent(HTML::h2(_("Message of the Day"))); return $html; Carsten On Monday, November 18, 2002, at 10:21 pm, Loyd Goodbar wrote: > I just installed PHPWiki v1.3.3, and am very pleased with it so far. I > tried > searching the archives, but they appear to be down at the moment. > > I'm trying to write a simple plugin for MOTD. I was under the > impression that > HTML code I used in the plugin was not translated. For instance, if I > use this > sample code in my plugin: > > function run($dbi, $argstr, $request) { > // No arguments at this time > // extract($this->getArgs($argstr, $request)); > $html = "One moon shows in every pool;\nIn every pool, the one moon."; > $html = ereg_replace("\n","<br />",$html); > return $html; > } > > I expected to see the following in the wiki: > > One moon shows in every pool; > In every pool, the one moon. > > However, I get this: > > One moon shows in every pool;<br />In every pool, the one moon. > > The source for which looks like this: > > One moon shows in every pool;<br />In every pool, the one moon. > > Even replacing the HTML breaks with wiki line breaks (%%%) did not > work. (I > thought wiki html transformation might still occur.) > > The note from the HelloWorld plugin states > // Any text that is returned will not be further transformed, > // so use html where necessary. > > This does not appear to be true. > Is there a way to get line breaks from a plugin's text? > > Thanks, > Loyd |