Jump to content

editable() - how to output a link?


mike77
 Share

Recommended Posts

In the API section of PW website I found a comment made by Apeisa. He wrote:

// If the page is editable, then output a link that takes us straight to the page edit screen:

if($page->editable()) {

echo "Edit";

}

I'd like to use this function but the code shown above won't print a link - just a static string. How to edit this so the output would be a link leading to the exact page edit screen in admin control panel?

Thanks.

PS. Link to the page where I found the comment: http://processwire.com/api/variables/page/

Link to comment
Share on other sites

This is already in the default installation, so study those templates and includes. For this particular wish it's something like this (from foot.inc):

<?php
// If the page is editable, then output a link that takes us straight to the page edit screen:
if($page->editable()) {
   echo "<a class='nav' id='editpage' href='{$config->urls->admin}page/edit/?id={$page->id}'>Edit</a>";
}
?>
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...