Documentation

Light-weight, fast, simple and powerful!
 
Translations of this page?:

Frontend links for page editing in backend

This “tutorial” is based on a forum thread started by Ormente with responses from Martijn. Consult that thread for further discussion.

It's often useful to be able to go directly to the backend to edit a page while browsing your site. You can make such a link in Wolf by copying this code into a snippet (filter set to ”-none-”):

<?php
 
    // Check there's a user session
    AuthUser::load();
 
    // Check the user is logged in and has page_edit permission.
    if (AuthUser::isLoggedIn() && AuthUser::hasPermission('page_edit')) {
 
        $url = BASE_URL.'admin/page/edit/'.$this->id();
        echo '<span class="quickedit"><a href="'.$url.'">Edit this page</a></span>';
    }
?>

Save the snippet as 'quickedit', and call the snippet in your layout with:

<?php $this->includeSnippet('quickedit'); ?>

where you want your edit link to appear.

You could also:

  • add some CSS rules for the .quickedit class;
  • use usernames instead of roles (see the original forum thread);
  • add another condition to limit the appearance of the “Edit this page” link to certain branches of your site;
  • etc.!

Thanks to Ormente for this suggestion!

 
tutorials/edit_this_page.txt · Last modified: 2013-08-29 10:05 by neilwightman
 
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2
Copyright 2010 wolfcms.org / design by yello studio / Wolf CMS Inside