Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Niepoprawne wyświetlanie
Gibcio
post
Post #1





Grupa: Zarejestrowani
Postów: 48
Pomógł: 0
Dołączył: 20.04.2005

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


Mam taką funkcję w pliku function.php do wczytywania zawartości pliku:
  1. <?
  2. function ReadTemplate($name) {
  3. $mainTemplate = file_get_contents($name);
  4. return $mainTemplate;
  5. }
  6.  
  7. function Menu() {
  8. echo "Menu";
  9. }
  10. ?>

index.php

  1. <?
  2. $title = "Tytul";
  3. include('function.php');
  4. $mainTemplate = ReadTemplate("template/blue/index.html");
  5. $mainTemplate = str_replace("<!--TITLE-->", $title, $mainTemplate);
  6. $mainTemplate = str_replace("<!--MENU-->", Menu(), $mainTemplate);
  7. echo $mainTemplate;
  8. ?>


index.html
  1. <title><!--TITLE--></title>
  2. </head>
  3. <table border="0" width="100%">
  4. <tr>
  5. <td width="100%" align="center"><!--TOP--></td>
  6. </tr>
  7. </table>
  8.  
  9. <table border="0" width="100%">
  10. <tr>
  11. <td width="20%" align="center"><!--MENU--></td>
  12. <td width="60%" align="center"></td>
  13. <td width="20%" align="center"></td>
  14. </tr>
  15. </table>
  16. </body>
  17. </html>

Problem jest taki że napis w funkcji Menu nie pojawia się w tej tabelce tylko zupełnie na górze strony - jak to rozwiącać, proszę o pomoc.

Z góry dziękuje!

Ten post edytował Gibcio 25.08.2007, 17:52:57
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Gibcio
post
Post #2





Grupa: Zarejestrowani
Postów: 48
Pomógł: 0
Dołączył: 20.04.2005

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


Zawartosc pliku z pozycjami menu:

Pozycja 1||link do pliku.html||
Pozycja 2||link do pliku html||

  1. <?
  2. function Menu()
  3. {
  4. $fp = 'path_do_plik_z_pozycjami';
  5. $file = file($fp);
  6. $total = count($file);
  7. for($i=0; $total>$i; $i++)
  8. {
  9. $a = split("|", chop($file[$i]));
  10. $b = explode("||", $file[$i]);
  11. return $b[0];
  12. }
  13. }
  14. ?>

w index.php

  1. <?php
  2. $mainTemplate = str_replace("<!--MENU-->", Menu(), $mainTemplate);
  3. ?>

wyświetli się tylko Pozycja 1 już 2 się nie wyświetli - może coś jest źle z funkcją Menu - Proszę o pomoc.
Go to the top of the page
+Quote Post

Posty w temacie


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: 3.10.2025 - 09:00