Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Closed TopicStart new topic
> [smarty] dubel include
krystian1991x
post 15.10.2010, 18:28:12
Post #1





Grupa: Zarejestrowani
Postów: 114
Pomógł: 0
Dołączył: 7.08.2010

Ostrzeżenie: (10%)
X----


Dubluje mi zawartość include ...

plik php
  1. <?php
  2. require('libs/Smarty.class.php');
  3. require('cfg.php');
  4.  
  5. $smarty = new Smarty;
  6.  
  7. $site = $_GET['id'];
  8. if($site != "") {
  9. switch($site) {
  10. case $site:
  11. require("$site.php");
  12. break;
  13.  
  14.  
  15. }
  16. }
  17.  
  18.  
  19. $smarty->assign("site", $site);
  20. $smarty->display('index.tpl');
  21.  
  22. ?>

index.tpl
  1. <!doctype html public "-//w3c//dtd html 4.01 transitional//en">
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=utf-8">
  5. <meta name="generator" content="pspad editor, www.pspad.com">
  6. <link rel="stylesheet" type="text/css" href="templates/style.css" />
  7. <title></title>
  8. </head>
  9. <body>
  10. <div id="site">
  11. <div id="head">
  12. <div id="login">
  13. {include_php file="login.php"}
  14. </div>
  15. </div>
  16. <div id="menu">
  17. <div style="padding-left: 35px;">
  18. <table cellspacing="0" cellpadding="0"><tr>
  19. <td><a href="index.php?id=news"><img border="0" src="templates/images/aktualnosci.jpg"></a></td><td><img border="0" src="templates/images/kreska.jpg"></td>
  20. <td><a href="index.php?id=comments"><img border="0" src="templates/images/multimedia.jpg"></a></td><td><img border="0" src="templates/images/kreska.jpg"></td>
  21. <td><a href="#"><img border="0" src="templates/images/download.jpg"></a></td><td><img border="0" src="templates/images/kreska.jpg"></td>
  22. <td><a href="#"><img border="0" src="templates/images/artykuly.jpg"></a></td><td><img border="0" src="templates/images/kreska.jpg"></td>
  23. <td><a href="#"><img border="0" src="templates/images/forum.jpg"></a></td><td><img border="0" src="templates/images/kreska.jpg"></td>
  24. <td><a href="#"><img border="0" src="templates/images/faq.jpg"></a></td><td><img border="0" src="templates/images/kreska.jpg"></td>
  25. <td><a href="#"><img border="0" src="templates/images/kontakt.jpg"></a></td>
  26. </tr></table>
  27. </div>
  28. </div>
  29. <div>
  30.  
  31. {if $site == ""}
  32. {include_php file="news.php"}
  33. {/if}
  34. {if $site != ""}
  35. {include file="`$site`.tpl"}
  36. {/if}
  37.  
  38. </div>
  39. </div>
  40. </body>
  41. </html>



Ten post edytował krystian1991x 15.10.2010, 18:28:51
Go to the top of the page
+Quote Post
nospor
post 16.10.2010, 08:12:23
Post #2





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




Przecież rozprawiasz już o tym tutaj:
http://forum.php.pl/index.php?showtopic=161135&st=20
Jeden temat naprawde wystarczy


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

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 - 11:16