Frontcontroller yardım

1 Cevap
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /index.php [NC,L]

php

<?php

$pagesDir = "pages";

// Get the request
$page = $_SERVER['REQUEST_URI'];   

// Strip the first slash
$page = substr($page, 1);

// Prevent access to higher level folders
$page = str_replace('..', '', $page);    

// Do some mapping to actual files in a subfolder
$page = "$pagesDir/$page";    

// Serve an error page if not found
if (!file_exists($page)) {
$page = "$pagesDir/error.html";
}

// Prevent anything from being output until it is ready
ob_start();
include($page);
$contents = ob_get_clean();

// Use a template with the variable $contents where you want the page's content to go
ob_start();
include($template);
$output = ob_get_clean();
echo $output;

?>

Warning: include() [function.include]: Failed opening '' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\index.php on line 29

1 Cevap

$template için boş bir dize değerlendirilir ediliyor, ve ben yine yerde PHP kaynak ilan görmüyorum.