Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Strona na szablonie, ala smart, problem
-swiezak-
post
Post #1





Goście







Witam wszystkich, tworze wlasnie swoja stronke i natrafilem na problem.
Mam plik index.php:
  1. <?
  2.  
  3. $id = $_GET['id'];
  4. if(!empty($id)) {
  5. if(is_file("pages/$id.html")) require "pages/$id.html";
  6.  
  7. else echo "Error 404";
  8. }
  9.  
  10. else require "pages/start.html";
  11.  
  12.  
  13.  
  14. $template = file_get_contents('template/1.tpl.php');
  15. $menu = file_get_contents('menu.php');
  16.  
  17.  
  18. $search = array ('{TITLE}', '{KEYWORDS}', '{DESCRIPTION}', '{TRESC}', '{MENU}');
  19. $replace = array ("$title", "$keywords", "$description", "$content", "$menu");
  20. $site = str_replace($search, $replace, $template);
  21.  
  22. print $site;
  23.  
  24. ?>


i plik z szablonem wygladajacy tak:

  1. <?php
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <title>{TITLE}</title>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <meta name="keywords" content="{KEYWORDS}" />
  8. <meta name="description" content="{DESCRIPTION}" />
  9. <link rel="stylesheet" href="main.css" type="text/css" />
  10. </head>
  11. <body>
  12. <div id="page">
  13. <div id="top"></div>
  14. <div id="menu_left">
  15. {MENU}
  16. </div>
  17. <div id="txt">{TRESC}</div>
  18. <div id="footer">
  19. Stopka
  20. </div>
  21. </div>
  22. </body>
  23. </html>
  24. ?>




I teraz moje pytanie:

Jak to zmienic zebym mogl miec w szablonie jakis include albo cos? bo narazie jak wstawie tam include to na stronie pokazuje sie jako zwykly tekst.

Bede wdzieczny za pomoc (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

Pozdrawiam
Go to the top of the page
+Quote Post

Posty w temacie
- swiezak   [PHP]Strona na szablonie, ala smart   23.08.2008, 14:11:55
- - swiezak   Nikt nie pomoze? Moglby ktos napisac jak inaczej m...   23.08.2008, 15:51:58
- - Lejto   Cytat(swiezak @ 23.08.2008, 15:11:55 ...   23.08.2008, 16:00:42


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

 



RSS Aktualny czas: 24.08.2025 - 19:26