Mam taki oto problem. Po wpisaniu w przeglądarce login.htm wyświetla się login.htm [tak jak chcę] gdy od razu po tym napiszę register.htm niestety nie zmienia się zawartość strony lecz nadal jest poprzednia [login.htm]. Teraz troszkę kodu.
index.php
<?php ... $body = $_GET["id"]; if($body == " ") { include("includes/news.php"); $smarty -> assign('file', 'news.tpl'); } else { { include("includes/$body.php"); $smarty -> assign('file', $body.'.tpl'); } else { include("includes/error.php"); $smarty -> assign('file', 'error.tpl'); } } $smarty -> display('index.tpl'); ?>
Teraz kod .htaccess
Kod
RewriteEngine On
RewriteRule ^index.htm/?$ index.php?id=news
RewriteRule ^register.htm/?$ index.php?id=register [L]
RewriteRule ^login.htm/?$ index.php?id=login [L]
RewriteRule ^index.htm/?$ index.php?id=news
RewriteRule ^register.htm/?$ index.php?id=register [L]
RewriteRule ^login.htm/?$ index.php?id=login [L]
Teraz kod index.tpl
Kod
...
<div class="left">
<div class="content">
{include file="$file"}
</div>
</div>
...
<div class="left">
<div class="content">
{include file="$file"}
</div>
</div>
...
Jak sprawić, żeby szablony dynamicznie się zmieniały? ; )
Z góry dziękuję za udzieloną pomoc.
Pozdrawiam
odświeżam