plugin:recent
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Previous revisionNext revision | |||
— | plugin:recent [2015-12-11 10:33] – old revision restored (2015-03-13 09:25) 141.65.129.192 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Changelog Plugin ====== | ||
+ | ---- plugin ---- | ||
+ | description: | ||
+ | author | ||
+ | email : iDo@woow-fr.com | ||
+ | type : syntax | ||
+ | lastupdate : 2005-08-12 | ||
+ | compatible : | ||
+ | depends | ||
+ | conflicts | ||
+ | similar | ||
+ | tags : include, changelog, listing, !maybe.broken, | ||
+ | ---- | ||
+ | |||
+ | ====== How to use ====== | ||
+ | |||
+ | Simply write ''< | ||
+ | |||
+ | ====== How to install ====== | ||
+ | |||
+ | First, Create a folder named ' | ||
+ | then create a file named ' | ||
+ | |||
+ | <code php> | ||
+ | <?php | ||
+ | |||
+ | if(!defined(' | ||
+ | if(!defined(' | ||
+ | require_once(DOKU_PLUGIN.' | ||
+ | |||
+ | /** | ||
+ | * All DokuWiki plugins to extend the parser/ | ||
+ | * need to inherit from this class | ||
+ | */ | ||
+ | class syntax_plugin_recent extends DokuWiki_Syntax_Plugin { | ||
+ | |||
+ | /** | ||
+ | * return some info | ||
+ | */ | ||
+ | function getInfo(){ | ||
+ | return array( | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | } | ||
+ | /** | ||
+ | * What kind of syntax are we? | ||
+ | */ | ||
+ | function getType(){ | ||
+ | return ' | ||
+ | } | ||
+ | /** | ||
+ | * Where to sort in? | ||
+ | */ | ||
+ | function getSort(){ | ||
+ | return 105; | ||
+ | } | ||
+ | /** | ||
+ | * Connect pattern to lexer | ||
+ | */ | ||
+ | function connectTo($mode) { | ||
+ | $this-> | ||
+ | } | ||
+ | /** | ||
+ | * Handle the match | ||
+ | */ | ||
+ | function handle($match, | ||
+ | return true; | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | * Create output | ||
+ | */ | ||
+ | function render($mode, | ||
+ | if($mode == ' | ||
+ | $renderer-> | ||
+ | $renderer-> | ||
+ | $renderer-> | ||
+ | return true; | ||
+ | } | ||
+ | return false; | ||
+ | } | ||
+ | | ||
+ | function _Rethtml_recent($first=0) { | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | //Setup VIM: ex: et ts=4 enc=utf-8 : | ||
+ | ?> | ||
+ | </ | ||
+ | |||
+ | ====== Contact ====== | ||
+ | |||
+ | This my first plugin. i hope you'll like it ;) \\ | ||
+ | ido [at] woow-fr [dot] com | ||
+ | |||
+ | ====== Comments ====== | ||
+ | |||
+ | > Looks good :-), a couple of comments ;-) \\ Why create a separate file for your '' | ||
+ | // at the top | ||
+ | require_once(DOKU_PLUGIN.' | ||
+ | // require_once(' | ||
+ | require_once(DOKU_INC.' | ||
+ | |||
+ | // at the bottom | ||
+ | |||
+ | function render($mode, | ||
+ | if($mode == ' | ||
+ | // $renderer-> | ||
+ | // a new revision, will automatically mean a fresh copy in the cache | ||
+ | $renderer-> | ||
+ | $renderer-> | ||
+ | $renderer-> | ||
+ | return true; | ||
+ | } | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | function _Rethtml_recent($first=0) { | ||
+ | | ||
+ | | ||
+ | | ||
+ | } </ | ||
+ | |||
+ | > I will try this and update the code asap :) Ty ! // | ||
+ | |||
+ | > That's OK ! i have updated the code ! Thanks very much ! i did not know ob_start function. It's a very very good fonction !!! // | ||
+ | |||
+ | |||
+ | > Current version of code breaks XHTML conformity. This is the error: // document type does not allow element " | ||
+ | |||
+ | >> " | ||
+ | |||
+ | > I changed the _Rethtml_recent() to NOT return the heading and the introduction line. It now looks like this: < | ||
+ | | ||
+ | | ||
+ | $html = ob_get_clean(); | ||
+ | $html = substr($html, | ||
+ | | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | > Here's a quick hack to display the latest 10 changes | ||
+ | >> No hack required, just change the recent config #~.~# --- // | ||
+ | |||
+ | > 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, | ||
+ | |||
+ | //store output and return if method is finished | ||
+ | ob_start(); | ||
+ | echo "< | ||
+ | foreach($recents as $recent){ | ||
+ | $date = date(" | ||
+ | echo "< | ||
+ | echo "< | ||
+ | echo html_wikilink(':' | ||
+ | echo "</ | ||
+ | } | ||
+ | echo "</ | ||
+ | | ||
+ | | ||
+ | </ |
plugin/recent.txt · Last modified: 2024-02-05 22:28 by Klap-in