KB:Advanced
From PageLime Documentation
Contents |
Advanced Client/User Interface
Create a dynamic "Edit this Page" link for clients (PHP)
Submitted by uspatriot55
Give your clients quick access to Pagelime editing with an "edit this page" link.
The key is understanding how PageLime links to your pages when in editing mode.
The first part of the URL looks like this:
The first part of the URL looks like this:http://cms.pagelime.com/CMS/?/#/editor/$/RequestedEditURL=
After that things get a little funky. Colons (:) are represented by the combination @3A and slashes (/) are represented by @2F.
The last part of the URL is a unique ID for each website you have set up with PageLime. This is tacked on the end of the URL as/RequestedSiteID=XXXX where XXXX is the four digit code for your particular website. You can figure out your site ID by logging in to PageLime like normal, selecting the site you want to edit and then looking in the address bar. The last four digits in the URL are your site ID.
Let's put this all together. If the URL you want to edit is http://www.ywamozarks.com/index.html, the PageLime URL where you edit it is going to look like this:
http://cms.pagelime.com/CMS/?/#/editor/$/RequestedEditURL=http@3A@2F@2Fwww.ywamozarks.com@2F@2Findex.html/RequestedSiteID=XXXX
So, to put a dynamic link on each page that will let your users edit that particular page, we'll just need to use PHP to pull in the current URL and append that to the standard PageLime URL.
Here's the code to do it.
<a href="http://cms.pagelime.com/CMS/?/#/editor/$/RequestedEditURL=http@3A@2F@2Fwww.yourwebsite.com@2F
<?php
// first we need to find out the path to the current file
$path = $_SERVER['SCRIPT_NAME'];
// now let's replace the slashes with PageLime's @2F symbols
$path = str_replace('/', '@2F', $path);
// and now we're ready to spit out the results
echo $path;
?>
/RequestedSiteID=XXXX <?php //Remember to replace XXXX with your site's ID ?>
" title="Edit this page in PageLime">Edit this page</a>
That's it! If you put this code into a PHP include, you'll have a nice link to edit every page of the site, even when new pages are added. It should even work within folders and sub-folders.
Advanced Navigation Manager Techniques
How to add "last" class (Velocity)
Submitted by embarkd
- Starting with some basic velocity code for your the navigation:
<div id="header" class="navstrip">
#foreach( $navItem in $navItems )
<a href="$navItem.URL">$navItem.Title</a> |
#end
</div>
- you can supplement the code with an if/else statement and counter in order to find the last item and apply a class to it.
#foreach( $navItem in $navItems )
#if ($velocityCount == $navItems.Count)
<a href="$navItem.URL">$navItem.Title</a>
#else
<a href="$navItem.URL">$navItem.Title</a>
#end
#end
(Thanks again to embarkd.)