SSbits - Home page
Site by Carbon Crayon
Submit a Post >

Snippets - Little bits of code to make you happy

Create an 'Edit this page' Link

For some sites you may want your client to be able to click a link on a particlar page and be taken strait to that page in the admin area. Here's what a link that does just that would look like:

 

<a href="admin/show/{$ID}" title="edit this page">Edit this page</a>

If you wanted this to only show up when a user is logged in you could use the CurrentMember call to check. So it would look like this:

 

<% if CurrentMember %>
      <a href="admin/show/{$ID}" title="edit this page">Edit this Page</a>
<% end_if %>

You could also take this a step further and write a function in your page controller to check whether the current user has permission to access the CMS using Permission::check('CMS_ACCESS_CMSMain') call.

Aram Balakjian avatar

Aram Balakjian

Aram is a web developer running London based agency Aab Web. He has a strong passion for developing attractive, usable sites around the SilverStripe CMS.

No one has commented on this page yet.

Post a comment ...

You cannot post comments until you have logged in. Login Here.

Advertisement

Site of the Month

Find SSbits on

Top Contributers

Rank Avatar Name
1 article image Aram Balakjian
2 article image Daniel Hensby
3 article image Marcus Dalgren
4 article image Hamish Campbell
5 article image Ty Barho
6 article image njorndare
7 article image Martijn van Nieuwenhoven
8 article image Darren-Lee
9 article image Roman Schmid
10 article image Matt Clegg

View full leaderboard


Advertisement