Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Closed TopicStart new topic
> [SMARTY] Dynamiczna zmiana szablonów
daw22
post 26.02.2008, 12:46:58
Post #1





Grupa: Zarejestrowani
Postów: 64
Pomógł: 1
Dołączył: 1.09.2007

Ostrzeżenie: (0%)
-----


Witam,
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

  1. <?php
  2. ...
  3. $body = $_GET["id"];
  4. if($body == " ")
  5. {
  6. include("includes/news.php");
  7. $smarty -> assign('file', 'news.tpl');
  8. }
  9. else
  10. {
  11. if (is_file("includes/$body.php"))
  12. {
  13. include("includes/$body.php");
  14. $smarty -> assign('file', $body.'.tpl');
  15. }
  16. else
  17. {
  18. include("includes/error.php");
  19. $smarty -> assign('file', 'error.tpl');
  20. }
  21. }
  22. $smarty -> display('index.tpl');
  23. ?>



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]


Teraz kod index.tpl

Kod
...
      <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

Ten post edytował daw22 25.02.2008, 16:23:59
Go to the top of the page
+Quote Post
Sabistik
post 26.02.2008, 13:12:09
Post #2


Administrator wortalu


Grupa: Przyjaciele php.pl
Postów: 960
Pomógł: 39
Dołączył: 21.10.2003
Skąd: Kraków

Ostrzeżenie: (0%)
-----


Crossposting - http://forum.php.pl/index.php?showtopic=88338
Go to the top of the page
+Quote Post

Closed TopicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 13.06.2025 - 08:41