Credo di capire che ti serve un MVC ridottissimo (al solo VIEW), magari prova con i seguenti script:
struttura base:
- index.php
- .htaccess
- view/view.class.php
- template/home.html
- template/tuapagina.html
index.php:
Codice PHP:
require_once("view/view.class.php");
$page = "";
if (isset($_GET['page'])) { $page = addslashes($_GET['page']); }if ($page=="" || $page=="/") {$page="home";}
$view = new VIEW();$view->showPage($page);
.htaccess
codice:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)?(.*)$ index.php?page=$1&$2 [L,QSA]
view.class.php
Codice PHP:
class VIEW {
function __construct() {
//
}
function showPage($page="home") {
$fileHtmlChoice="template/".$page.".html"; $risultatoPagina = str_replace("\"","\\\"",implode("",file($fileHtmlChoice))); eval("\$risultatoPagina = \"$risultatoPagina\";"); $this->output = $risultatoPagina; echo $this->output;
}
}
La pagina home.html è la tua home page, mentre tuapagina.html è una delle pagine del tuo sito richiamabile così:
http://www.tuosito.com/tuapagina
Ciao!