Ever had to transfer a very large number of flat files to a CMS? There are many ways to achieve this, but sooner of later you will have to do some grunt work with code. One of the solutions involves creating a naked version of your content with a very basic navigation system and a COPY CODE link.
If you create your archive using php, you can include this bit of code on your pages to make each one, just one click away from displaying source code:
1. Create this bloc of php in the top of the template file
<?phpfunction curPageURL() {
$pageURL = ‘http’;
if ($_SERVER["HTTPS"] == “on”) {$pageURL .= “s”;}
$pageURL .= “://”;
if ($_SERVER["SERVER_PORT"] != “80″) {
$pageURL .= $_SERVER["SERVER_NAME"].”:”.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
?>
2. Add this link to all your pages
<a href=”view-source:<?php echo curPageURL(); ?>” target=”_blank”>View source of current page</a>
What We Tell The World
- About this server
- The hostname: websiteforensics.com
- This server address: 209.237.150.20
What You Tell The World
- Your IP address: 38.107.179.237
- Your hostname: 38.107.179.237
- Your country domain: .237
- You came from:
- Requested URL: /code/reveal-source-code-with-link/
- Browser INFO: CCBot/1.0 (+http://www.commoncrawl.org/bot.html)