DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:recent

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Both sides next revision
plugin:recent [2010-01-21 07:01]
202.122.149.195
plugin:recent [2021-01-22 17:59] (current)
Aleksandr
Line 11: Line 11:
 conflicts  conflicts 
 similar    :  similar    : 
-tags       : include, changelog, listing, !maybe.broken+tags       : include, changelog, listing, !maybe.broken, recent
 ---- ----
  
 +===== How to use =====
  
-====== How to use ====== +Simply write ''<nowiki>{{changelog}}</nowiki>'' in the source page. 
-Simply write <nowiki>{{changelog}}</nowiki> in the source page.+ 
 +===== How to install =====
  
-====== How to install ====== 
 First, Create a folder named 'recent' in 'lib/plugins' First, Create a folder named 'recent' in 'lib/plugins'
 then create a file named 'syntax.php' in this folder and copy/paste this code : then create a file named 'syntax.php' in this folder and copy/paste this code :
 +
 <code php> <code php>
 <?php <?php
Line 97: Line 99:
 </code> </code>
  
-====== Contact ======+===== Contact ===== 
 This my first plugin. i hope you'll like it ;) \\ This my first plugin. i hope you'll like it ;) \\
 ido [at] woow-fr [dot] com ido [at] woow-fr [dot] com
-====== Comments ======+ 
 +===== Comments ===== 
 > Looks good :-), a couple of comments ;-) \\ Why create a separate file for your ''Rethtml_recent()'' function?  Define it as a function within your plugin class and call it using ''%%$this->Rethtml_recent()%%''. Note, per the [[devel:Syntax Plugins|syntax plugin guidelines]], its good policy to prefix your own functions with an underscore. I see you have reworked the ''html_recent()''((inc/html.php)) function  to output to a string.  You could future proof your plugin by using [[http://www.php.net/manual/en/ref.outcontrol.php|PHP output buffering]] functions and calling ''html_recent()'' directly. All of which would make your code go something like this ...<code php> > Looks good :-), a couple of comments ;-) \\ Why create a separate file for your ''Rethtml_recent()'' function?  Define it as a function within your plugin class and call it using ''%%$this->Rethtml_recent()%%''. Note, per the [[devel:Syntax Plugins|syntax plugin guidelines]], its good policy to prefix your own functions with an underscore. I see you have reworked the ''html_recent()''((inc/html.php)) function  to output to a string.  You could future proof your plugin by using [[http://www.php.net/manual/en/ref.outcontrol.php|PHP output buffering]] functions and calling ''html_recent()'' directly. All of which would make your code go something like this ...<code php>
 // at the top // at the top
Line 148: Line 153:
 >> No hack required, just change the recent config #~.~# --- //[[keylmf@linuxmail.org|MF Low]]// >> No hack required, just change the recent config #~.~# --- //[[keylmf@linuxmail.org|MF Low]]//
  
 +> Change the given method to get more control about recently changed pages. So i can list new pages the way i want ;) See live demo at the bottom of this page www.umingo.de 
 +<code php>
 +function _Rethtml_recent() {
 + global $conf;
 + global $ID;
 + $startAt = 0;
 + $numberOfEntries = 10;
 +
 +        $recents = getRecents($startAt,$numberOfEntries ,'',RECENTS_SKIP_DELETED);
 +
 + //store output and return if method is finished
 +        ob_start();
 + echo "<ul>";
 + foreach($recents as $recent){
 +   $date = date("d.m.y", $recent['date']);
 +   echo "<li>";
 +   echo "<span class='date'>".$date."</span> - ";
 +   echo html_wikilink(':'.$recent['id'], useHeading('navigation')?null:$recent['id']);
 +   echo "</li>";
 +        }
 + echo "</ul>";
 +         return ob_get_clean();
 +   
 +</code>
plugin/recent.1264053699.txt.gz · Last modified: 2010-01-21 07:01 by 202.122.149.195