Skip to content

Instantly share code, notes, and snippets.

@themasch
Created October 14, 2012 23:26
Show Gist options
  • Select an option

  • Save themasch/3890144 to your computer and use it in GitHub Desktop.

Select an option

Save themasch/3890144 to your computer and use it in GitHub Desktop.
CMS in 10 Zeilen
<htmlzeugsblafoo>
<?php
$request = $_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI'];
$dirname = __DIR__ . '/';
$request = preg_replace('(^'.$dirname.')', '', $request);
$page = trim($request, '/');
$path = './content/' . $page . '.html';
$allowed = array_merge(glob('./content/*.html'), glob('./content/*/*.html'));
if(in_array($path, $allowed)) include $path;
else include './content/home.html';
?>
</htmlzeugsblafoo>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment