Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> $template -> . Błąd w wczytywaniu skórki .
Kaiba Ziom
post
Post #1





Grupa: Zarejestrowani
Postów: 49
Pomógł: 0
Dołączył: 25.10.2006
Skąd: Londyn

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


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ć :|
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
kwiateusz
post
Post #2


Admin Techniczny


Grupa: Administratorzy
Postów: 2 071
Pomógł: 93
Dołączył: 5.07.2005
Skąd: Olsztyn




Przeczytaj: http://forumphp.nq.pl/Przeczytaj-FAQ-PHPEd...esz-t42526.html

A następnie czekam na PW z poprawnym tematem.
Go to the top of the page
+Quote Post

Closed 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 - 18:16