Skip to content

Instantly share code, notes, and snippets.

@rschumm
Created August 17, 2012 08:45
Show Gist options
  • Save rschumm/3377094 to your computer and use it in GitHub Desktop.
Save rschumm/3377094 to your computer and use it in GitHub Desktop.
Mini Layout Engine für Joopi
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?site=$1

danke Sven ;-)

<html>
<head>
</head>
<body>
<h1>Welcome Rémy</h1>
<div>
<?php
if(isset($_GET['site'])) {
$site = $_GET['site'];
$illegal = array("\\", "/", ".");
$site = str_replace($illegal, "", $site);
if(!file_exists('sites/' . $site . '.php')) {
$site = '404';
}
} else {
$site = 'home';
}
include 'sites/' . $site . '.php'
?>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment