Sidebar: Adding an edit button

This tip was provided by Dmitry Cherniachenko.

I have modified the code here slightly to better support different Dokuwiki configurations. I am testing a fully integrated version of this code which will add a tpl_sidebar_editbtn() function to the template shifting the bulk of this code into tplfn_sidebar.php. — Christopher Smith 2005/10/03 19:10

To add an 'Edit' button you just need to modify tpl/sidebar/main.php file:

    <!-- wikipage stop -->
  </div>
  <?php if ($conf['sidebar']['enable'] && $ACT == 'show') { ?>
    <div id="sidebar">
 
      <?php if (($idSidebar = getSidebarFN(getNS($ID), $conf['sidebar']['page'])) && (auth_quickaclcheck($idSidebar) >= AUTH_EDIT)) { ?>
      <div class="secedit" style="padding-right:2px;padding-top:2px;">
        <form class="button" method="post" action="<?php echo wl($idSidebar,'do=edit')?>" onsubmit="return svchk()">
          <input type="hidden" name="do" value="edit" />
          <input type="hidden" name="rev" value="" />
          <input type="hidden" name="id" value="<?php echo $idSidebar?>" />
          <input type="submit" value="<?php echo $lang['btn_edit'] ?>" class="button" />
        </form>
      </div>
      <?php } ?>
      <?php tpl_sidebar(); ?>
    </div>
  <?php } ?>
  <div class="clearer">&nbsp;</div>
 

Note this will also remove sidebar from Edit and other 'non-show' pages ($ACT == 'show') - you might also want to avoid inserting CSS in that case.
Dmitry Cherniachenko 2005/10/03 12:45

 
tutorials/sidebar_edit_button.txt · Last modified: 2006/06/02 10:41 by 207.45.248.17
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki