Mam pewien problem .
<?php
class template
{
function load_file($template, $file)
{
if(!$fd = fopen("templates/$template/$file.html", 'r')) {
echo("Nie można wczytać skórki"); }
else
{
$rozmiar = filesize("templates/$template/$file.html"); $result=fread($fd, $rozmiar); }
return $result;
}
function make_arg($file, $whatreplace, $result)
{
$result = str_replace("<!--$whatreplace-->", $result, $file); return $result;
}
function remove($file, $name)
{
$file = preg_replace('#<!--if:' . $name . '-->(.*?)<!--endif:' . $name . '-->#s', '', $file); return $file;
}
}
{
$prawaadmina=0;
}
$template=new template();
{
$main_template=$template->load_file("default", "test");
}
$main_template=$template->make_arg($main_template, "tytul", "jakistam tytul");
if($prawaadmina==0)
{
$main_template=$template->remove($main_template, "<!--endif:mam_dostep_do_admina-->");
}
?>
w test.php
<!--tytul-->
<!--if:mam_dostep_do_admina-->
<a href="admin.php">admin
</a> <!--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ć :|