Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: $template -> . Błąd w wczytywaniu skórki .
Forum PHP.pl > Forum > Przedszkole
Kaiba Ziom
Mam pewien problem .

  1. <?php
  2. class template
  3. {
  4.  function load_file($template, $file)
  5. {
  6.  if(!$fd = fopen("templates/$template/$file.html", 'r'))
  7.  {
  8. echo("Nie można wczytać skórki");
  9.  }
  10. else
  11.  {
  12. $rozmiar = filesize("templates/$template/$file.html");
  13. $result=fread($fd, $rozmiar);
  14.  }
  15.  return $result;
  16.  }
  17. function make_arg($file, $whatreplace, $result)
  18. {
  19.  $result = str_replace("<!--$whatreplace-->", $result, $file);
  20.  return $result;
  21. }
  22. function remove($file, $name)
  23. {
  24. $file = preg_replace('#<!--if:' . $name . '-->(.*?)<!--endif:' . $name . '-->#s', '', $file);
  25. return $file;
  26. }
  27. }
  28.  {
  29. $prawaadmina=0;
  30.  }
  31. $template=new template();
  32.  {
  33. $main_template=$template->load_file("default", "test");
  34.  }
  35. $main_template=$template->make_arg($main_template, "tytul", "jakistam tytul");
  36.  
  37.  if($prawaadmina==0)
  38.  {
  39. $main_template=$template->remove($main_template, "<!--endif:mam_dostep_do_admina-->");
  40.  }
  41.  echo $main_template;
  42.  
  43. ?>


w test.php

  1. <b>
  2. <!--tytul-->
  3. </b>
  4. <br>
  5. <!--if:mam_dostep_do_admina-->
  6. <a href="admin.php">admin</a>
  7. <!--endif:mam_dostep_do_admina-->


Gdy wejdę w przeglądarke wyskakuje :

Warning: fopen(templates/default/test.html) [function.fopen]: failed to open stream: No such file or directory in D:\INTERNET\WebServ\httpd\template\index.php on line 6
Nie można wczytać skórki

Ja nie mam pomysłu jak to rozwiązać :|
kwiateusz
Przeczytaj: http://forumphp.nq.pl/Przeczytaj-FAQ-PHPEd...esz-t42526.html

A następnie czekam na PW z poprawnym tematem.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.