跳至内容
Python 俱乐部
用户工具
登录
站点工具
搜索
工具
显示页面
修订记录
反向链接
最近更改
媒体管理器
网站地图
登录
>
最近更改
媒体管理器
网站地图
您的足迹:
dokuwiki:template-backlink
====== 取消Dokuwiki中的反向链接backlink ====== ===== 什么是Dokuwiki的反向链接 ===== Dokuwiki默认模板会在页面的header中文章标题上面生成这个页面的反向链接。 如本文的反向链接就是:http://www.pythonclub.org/dokuwiki/template-backlink?do=backlink 可是我不喜欢这个设计,所以想着把Dokuwiki的这个backlink去掉,其实也很简单。 ===== 取消Dokuwiki反向链接backlink ===== 在你所用模板的main.php中查找类似下面代码的代码段: <code php> <div class="header"> <div class="pagename"> [[<?php tpl_link(wl($ID,'do=backlink'),tpl_pagetitle($ID,true))?>]] </div> <div class="logo"> <?php tpl_link(wl(),$conf['title'], 'name="dokuwiki__top" accesskey="h" title="[ALT+H]"')?> </div> </div> </code> 把上面的 <code php> [[<?php tpl_link(wl($ID,'do=backlink'),tpl_pagetitle($ID,true))?>]] </code> "do=backlink"去掉就可以了,如果你要更改header部分的内容,你也可以在这里面改。 其中涉及到三个函数:tpl_link, wl, tpl_pagetitle。 ==== tpl_link ==== tpl_link是生成link的函数,很简单,下面是函数定义在inc/template.php文件中: <code php> function tpl_link($url,$name,$more=''){ print '<a href="'.$url.'" '; if ($more) print ' '.$more; print ">$name</a>"; return true; } </code> ==== wl ==== 生成wiki页面的link,在inc/common.php中定义的: <code php> /** * This builds a link to a wikipage * * It handles URL rewriting and adds additional parameter if * given in $more * * @author Andreas Gohr <andi@splitbrain.org> */ function wl($id='',$more='',$abs=false,$sep='&'){ global $conf; if(is_array($more)){ $more = buildURLparams($more,$sep); }else{ $more = str_replace(',',$sep,$more); } $id = idfilter($id); if($abs){ $xlink = DOKU_URL; }else{ $xlink = DOKU_BASE; } if($conf['userewrite'] == 2){ $xlink .= DOKU_SCRIPT.'/'.$id; if($more) $xlink .= '?'.$more; }elseif($conf['userewrite']){ $xlink .= $id; if($more) $xlink .= '?'.$more; }elseif($id){ $xlink .= DOKU_SCRIPT.'?id='.$id; if($more) $xlink .= $sep.$more; }else{ $xlink .= DOKU_SCRIPT; if($more) $xlink .= '?'.$more; } return $xlink; } </code> ==== tpl_pagetitle ==== 这个很好理解,就是页面的title,在inc/template.php中定义: <code php> /** * Prints or returns the name of the given page (current one if none given). * * If useheading is enabled this will use the first headline else * the given ID is used. * * @author Andreas Gohr <andi@splitbrain.org> */ function tpl_pagetitle($id=null, $ret=false){ global $conf; if(is_null($id)){ global $ID; $id = $ID; } $name = $id; if ($conf['useheading']) { $title = p_get_first_heading($id); if ($title) $name = $title; } if ($ret) { return hsc($name); } else { print hsc($name); return true; } } </code>
dokuwiki/template-backlink.txt
· 最后更改: 2010/06/02 01:18 (外部编辑)
页面工具
显示页面
修订记录
反向链接
回到顶部