[dokuwiki] Re: once again: showing recent articles, but only the title (including a link)

Helge Kaltenbach пишет:
> Hello everyone,
>
> I asked a few days ago for a blog plugin or a recent articles plugin
> or similar.
>
> The blog plugin was suggested, but it seems it's not really what I want.
>
> To specify my question:
>
> Is there a plugin, that links me the titles of all pages of a
> specified namespace to another page?
>
> Basically the blog plugin with a link on the title and not showing the
> whole page.
>
> Any ideas?
I have the same problem. To solbe, I have just mixed code in the
syntax/archive.php and syntax/blog.php, creating syntax/headers.php.
It works like blog, but flags are pagelist flags (like in archive), and
it shows only 1st headers of each entry. Syntax is:
{{headers>[namespace]?[last count]&[pagelist flags]}}
* @author Robert Rackl */ // must be run within Dokuwiki if (!defined('DOKU_INC')) die(); if (!defined('DOKU_LF')) define('DOKU_LF', "\n"); if (!defined('DOKU_TAB')) define('DOKU_TAB', "\t"); if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'syntax.php'); class syntax_plugin_blog_headers extends DokuWiki_Syntax_Plugin { function getInfo(){ return array( 'author' => 'Esther Brunner', 'email' => 'wikidesign@xxxxxxxxx', 'date' => '2007-08-22', 'name' => 'Blog Plugin (blog component)', 'desc' => 'Displays a number of recent entries from a given namesspace', 'url' => 'http://www.wikidesign.ch/en/plugin/blog/start', ); } function getType(){ return 'substition'; } function getPType(){ return 'block'; } function getSort(){ return 307; } function connectTo($mode) { $this->Lexer->addSpecialPattern('\{\{headers>.*?\}\}',$mode,'plugin_blog_headers'); } function handle($match, $state, $pos, &$handler){ global $ID; $match = substr($match, 10, -2); // strip {{blog> from start and }} from end list($match, $flags) = explode('&', $match, 2); $flags = explode('&', $flags); list($match, $refine) = explode(' ', $match, 2); list($ns, $num) = explode('?', $match, 2); if (!is_numeric($num)){ if (is_numeric($ns)){ $num = $ns; $ns = ''; } else { $num = 5; } } if ($ns == '') $ns = cleanID($this->getConf('namespace')); elseif (($ns == '*') || ($ns == ':')) $ns = ''; elseif ($ns == '.') $ns = getNS($ID); else $ns = cleanID($ns); return array($ns, $num, $flags, $refine); } function render($mode, &$renderer, $data){ list($ns, $num, $flags, $refine) = $data; $first = $_REQUEST['first']; if (!is_numeric($first)) $first = 0; // get the blog entries for our namespace if ($my =& plugin_load('helper', 'blog')) $entries = $my->getBlog($ns); // use tag refinements? if ($refine){ if (plugin_isdisabled('tag') || (!$tag =& plugin_load('helper', 'tag'))){ msg($this->getLang('missing_tagplugin'), -1); } else { $entries = $tag->tagRefine($entries, $refine); } } if (!$entries){ if ((auth_quickaclcheck($ns.':*') >= AUTH_CREATE) && ($mode == 'xhtml')){ $renderer->info['cache'] = false; $renderer->doc .= $this->_newEntryForm($ns); } return true; // nothing to display } // slice the needed chunk of pages $more = ((count($entries) > ($first + $num)) ? true : false); $entries = array_slice($entries, $first, $num); if ($mode == 'xhtml'){ // prevent caching to ensure the included pages are always fresh $renderer->info['cache'] = false; // show new entry form $perm_create = (auth_quickaclcheck($ns.':*') >= AUTH_CREATE); if ($perm_create && ($this->getConf('formposition') == 'top')) $renderer->doc .= $this->_newEntryForm($ns); if (!$entries) return true; // nothing to display // let Pagelist Plugin do the work for us if (plugin_isdisabled('pagelist') || (!$pagelist =& plugin_load('helper', 'pagelist'))){ msg($this->getLang('missing_pagelistplugin'), -1); return false; } $pagelist->setFlags($flags); $pagelist->startList(); foreach ($entries as $entry){ $pagelist->addPage($entry); } $renderer->doc .= $pagelist->finishList(); } return true; } /* ---------- (X)HTML Output Functions ---------- */ /** * Displays links to older newer entries of the blog namespace */ function _browseEntriesLinks($more, $first, $num){ global $ID; $ret = ''; $last = $first+$num; if ($first > 0){ $first -= $num; if ($first < 0) $first = 0; $ret .= '

'.DOKU_LF.'<< '.$this->getLang('newer').''; if ($more) $ret .= ' | '; else $ret .= '

'; } else if ($more){ $ret .= '

'.DOKU_LF; } if ($more){ $ret .= ''. $this->getLang('older').' >>'.DOKU_LF.'

'.DOKU_LF; } return $ret; } /** * Displays a form to enter the title of a new entry in the blog namespace * and then open that page in the edit mode */ function _newEntryForm($ns){ global $lang; global $ID; return '
'.DOKU_LF. ''.DOKU_LF. DOKU_TAB.'
'.DOKU_LF. DOKU_TAB.DOKU_TAB.''.$this->getLang('newentry').''.DOKU_LF. DOKU_TAB.DOKU_TAB.''.DOKU_LF. DOKU_TAB.DOKU_TAB.''.DOKU_LF. DOKU_TAB.DOKU_TAB.''.DOKU_LF. DOKU_TAB.DOKU_TAB.''.DOKU_LF. DOKU_TAB.DOKU_TAB.''.DOKU_LF. DOKU_TAB.'
'.DOKU_LF. ''.DOKU_LF. '
'.DOKU_LF; } } //Setup VIM: ex: et ts=4 enc=utf-8 :

Other related posts: