Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In DokuWiki, is there any plugin compatible with the latest stable release (2009-02-14), that can show the edit buttons on section headers (like Wikipedia or MediaWiki) instead of showing them at the end of the section's text.

The default way is confusing since when you want to edit a section you have to scroll to the end of its content's and click the edit button there.

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

Okay, I figured out how to do it myself, and here is the solution so you can have edit buttons on the section headers, like Wikipedia.

Open up the following file in a text editor.

"\dokuwiki\inc\parser\handler.php"

Near line 110 you will find this:

    if ($level<=$conf['maxseclevel']) {
        $this->_addCall('section_edit',array($this->status['section_edit_start'], $pos-1, $this->status['section_edit_level'], $this->status['section_edit_title']), $pos);
        $this->status['section_edit_start'] = $pos;
        $this->status['section_edit_level'] = $level;
        $this->status['section_edit_title'] = $title;
    }

Replace the above with this:

    if ($level<=$conf['maxseclevel']) {
        $this->status['section_edit_start'] = $pos;
        $this->status['section_edit_level'] = $level;
        $this->status['section_edit_title'] = $title;
        $this->_addCall('section_edit',array($this->status['section_edit_start'], $pos-1, $this->status['section_edit_level'], $this->status['section_edit_title']), $pos);
    }

Save and close the PHP file, and reload an article on your wiki -- and voila! you have successfully "modded" DokuWiki to have edit buttons near every header, to edit the corresponding section.

Hope this helps.

share|improve this answer
    
The only downsides are: (1) you'll see one extra edit button at the end the article (2) editing a section will show all wikitext in the article from that section onwards .. (both don't really matter so this fix is workable!) –  Jarvis Aug 20 '09 at 9:28
    
Oh but there's another problem (3) editing a section seems to duplicate it when you save changes –  Jarvis Aug 20 '09 at 10:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.