Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Smart - proszę spojrzeć w szkielet. Nie wyświetla podstron.
casperii
post
Post #1





Grupa: Zarejestrowani
Postów: 681
Pomógł: 28
Dołączył: 14.08.2014

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


Panowie z racji tego, że nie ogarnąłem MVC to na chwilę obecną sobie odpuściłem i postanowiłem pisać stronę opartą o smarty.
Zresztą jest to mały serwis logowanie, rejestracja więc zrobię to po staremu - smarty.

  1.  
  2. <?php
  3. define( 'dostep', 1 );
  4. header('Content-Type: text/html; charset=utf-8');
  5. include ("tempp.php");
  6. require_once 'libs/Smarty.class.php';
  7. if (!file_exists('templates/'.$template_name.'/index.tpl')){
  8. echo 'Brak pliku index.tpl lub folderu. Główny plik pownien znajdować się w folderze templates/nazwa_szablonu';
  9.  
  10. }else{
  11.  
  12. $page=basename($_GET['w']);
  13. if (!empty($_GET['w']) and file_exists("controller/".$_GET['w'].".php")){
  14. switch($page) {
  15. //case ''.$page.'': $file = "controller/".$page.".php";
  16. case ''.$page.'' : include('controller/'.$page.'.php');
  17. break;
  18. default: $file = "controller/home.php";}
  19. }else{
  20.  
  21. $file='controller/home.php';
  22. }
  23.  
  24. $smarty = new Smarty;
  25. $smarty -> assign('page', $page);
  26. $smarty -> assign('file', $file);
  27. $smarty -> display(''.$template_name.'/index.tpl');
  28.  
  29. }
  30. ?>
  31.  


Czy powyższy kod jest optymalnie napisany? Nie zawiera błędów?
Druga sprawa to nie wiem czemu nie wczytuje mi podstrony test.

index.php?w=test

plik test.tpl znajduje się w templates
plik test.php znajduje się w controller

Ten post edytował casperii 6.03.2016, 23:18:42
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 14:42