Translations of this page?:
General
Getting Support
Administration
Design
Wolf Reference
Plugin Development
Core Development
- Design documents
- Working guidelines
- References
Press, Graphics and Translations
Wolf CMS books section
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 EITHER the administrator role or the my_new_role role. if (AuthUser::isLoggedIn() && AuthUser::hasPermission('administrator,my_new_role')) { $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
.quickeditclass; - 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!
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2
