[[|Top]] # Links to top of page
==== So how? ====
In inc\parser\xhtml.php change the function header by this one :
(line 134)
function header($text, $level, $pos) {
$hid = $this->_headerToLink($text,true);
//only add items within configured levels
$this->toc_additem($hid, $text, $level);
// write the header
$this->doc .= DOKU_LF;
if($level > 1){
$this->doc .= html_topbtn2();
}
$this->doc .='';
$this->doc .= $this->_xmlEntities($text);
$this->doc .= " ".DOKU_LF;
}
then : create the function "html_topbtn2" under "html_btn" in "inc\html.php"
(line 165)
function html_topbtn2(){
global $lang;
$ret = '';
$ret = ''. $lang['btn_top'].' ';
return $ret;
}
===== Top button beside edit button =====
--- html.php-orig 2008-07-06 04:28:06.241410000 +0200
+++ html.php 2008-07-06 04:40:15.171058000 +0200
@@ -94,6 +94,7 @@
$secedit = '';
$secedit .= '';
+ $secedit .= html_topbtn();
$secedit .= html_btn('secedit',$ID,'',
array('do' => 'edit',
'lines' => "$section",
@@ -115,12 +116,17 @@
$text = preg_replace_callback('##',
'html_secedit_button', $text);
}else{
- $text = preg_replace('##','',$text);
+ $text = preg_replace_callback('##','html_topbtn_div',$text);
}
return $text;
}
+function html_topbtn_div ()
+{
+ return ''.html_topbtn().'';
+}
+
/**
* Just the back to top button (in its own form)
*
Somewhere else i also rewrite:
$lang['btn_top'] = '['.$lang['btn_top'].']';
I use this with the monobook template, looks nice.
//6.7.2008 Peter//
>>Would be good to know what path you refer here. I did not find the right file or section or the file changed heavily in the meantime.
>>
>>//2011-02-18 Taggic//
===== Superseded =====
:?: Isn't this essentially superseded by the [[plugin:uparrow|Up Arrow plugin]]? --- //[[luis.machuca@gulix.cl|Luis Machuca Bezzaza]] 2009/09/21 19:37//
No, adding this code **automatically** generates a back_to_top link before headers , , etc. All except for . \\
John 2009/11/4