DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:phpwikify:discussion

Plugin PHP Wikify Discussion

This plugin is exactly what I have been looking for! The ability to generate Wiki code using PHP and then getting it parsed is very flexible indeed. For example, if you want to display certain Wiki text when meeting certain conditions - say for example, at a certain time of day - then you can use PHP to check for those conditions and then generate the appropriate Wiki text. It opens the doors to a lot of functionality - but, obviously, the potential security aspect must be understood and accepted.


Impressive, sincerely is the first plugin that is really useful to me, I wrote a dynamic menu generator in PHP because phpwikify made it possible, nice job. I post here the “automenu” as an example of what phpwikify can do, if anyone interested in developing it tell me, thanks: algspd at gmail dot com (sorry for bad English) To make the automenu work in real time, set cache to only a few seconds an this will include new pages automatically.

<phpwikify>
 
echo "<html><div style='margin-left: 30px;'>";
 
$namespaces = array("howto", "robotics", "wiki");
foreach ($namespaces as $namespace){
 echo "<br><b><u>".strtoupper($namespace)."</u></b><br><ul>";
 $dir=opendir("/var/www/data/pages/$namespace/");
 while ($archivo = readdir($dir)){
   if ($archivo!="." & $archivo!=".."){
 
     $name = basename($archivo, '.'. pathinfo($archivo, PATHINFO_EXTENSION));
 
     $name_c = str_replace("_", " ", ucwords($name));
 
     echo "<li><a href='?id=howto:$name'>$name_c</a><br>";}}
 closedir($dir);
 echo "</ul>";
}
echo "</div></html>";
</phpwikify>

MP - 10/04/2008


This is exactly the kind of extension I´ve been looking for. Only problem is: I use MediaWiki, not DokuWiki. Not being more than a novice coder, I wonder if there is any equivalent extension for MediaWiki, or if this function can be made compatible? Thanks!


:?: This is an excellent plugin, thank you very much for sharing this. Is there any reason the output generated by this wouldn't work with <file txt somefile.txt></file> tags? I'm not sure if I'm doing it wrong, or if the plugin is not compatible with these tags. Thanks!

:!: That is a limitation of this plugin. You can use <file txt somefile.txt>…</file> but, as the page does not contain the file, download will not work. You should use <file txt>…</file>, ie a file block without download.


Sorry to say so, but for me it does not work with Adora Belle.

  • I tried MP's example, but there are no <a> tags in the resulting page code.
  • my own code1) (below) results in garbled output with phpwikify, but works fine within php tags.
<phpwikify>
 
echo "\n< co de>";
 
$filetolookat = "ftp://linux.intranet.ufz.de/ubuntu/ufzmount.bash";
$modzeit = date("Y-m-d H:m", filemtime($filetolookat));
$inhalt = file_get_contents($filetolookat);
$inhalt = nl2br(htmlentities($inhalt, ENT_COMPAT, 'UTF-8'));
$inhalt = str_replace("\t", '&nbsp;&nbsp;&nbsp;&nbsp;', $inhalt);
$inhalt = str_replace('  ', '&nbsp;&nbsp;'            , $inhalt);
 
echo "$inhalt</ co de>\n";
echo "\n---\n";
echo "Zuletzt geändert: $modzeit";
 
</phpwikify>

results in

linux.intranet.ufz.de/ubuntu/ufzmount.bash“; $inhalt = file_get_contents($filetolookat); $modzeit = date(„Y-m-d H:m“, filemtime($filetolookat)); $inhalt = nl2br(htmlentities($inhalt, ENT_COMPAT, 'UTF-8')); $inhalt = str_replace(„\t“, '&nbsp;&nbsp;&nbsp;&nbsp;', $inhalt); $inhalt = str_replace(' ', '&nbsp;&nbsp;' , $inhalt); echo$inhalt</ co de>\n“; echo „\n---\n“; echo „Zuletzt geändert: $modzeit“; </phpwikify> 

Werner Flamme 2012/12/03 15:54


This is working very well for me after changing the path for the plugins folder. I see this has not been update in a very long time. If you change inc/plugins to lib/plugins it will work as expected. The main site is not responding and not sure how to contact the owner but I would not mind to adopt this plugin for use in the extension manager if possible.

Tehdango 2017-02-23 17:47

← Back to Plugin PHP Wikify

1)
slightly modified to not garble this page: < co de> and </ co de> do not contain any spaces on my page, but they garble the output of this page :-(
plugin/phpwikify/discussion.txt · Last modified: 2020-06-05 23:41 by trailjeep

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki