<?
include("config.php");
class template
{
function load_file($template, $file)
{
if(!$fd = fopen("templates/$template/$file.html", 'r')) {
echo("<center><h1>Error</h1></center><br><center>Błąd w wczytywaniu skórki.</center>"); }
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;
}
}
{
$template = new template();
if ($templates == 1) {
$main_template = $template->load_file("1", "index");
} elseif ($templates == 2) {
$main_template = $template->load_file("2", "index");
} elseif ($templates == 3) {
$main_template = $template->load_file("error", "index");
}
{
$main_template = $template -> make_arg($main_template, "login", "To jest logowanie");
$main_template = $template -> make_arg($main_template, "login1", "To jest logowanie1");
$main_template = $template -> make_arg($main_template, "test", hehe);
}
}
?>
Mam taki plik , a w index.html mam:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2"/> <meta http-equiv="Content-Language" content="PL"> <meta name="description" content="Rozbudowany serwis o wspaniałej grze MMorpg jaką jest Tibia."> <meta name="ROBOTS" content="index, follow"> <meta name="Author" content="Mazur"> <link rel="Stylesheet" type="text/css" href="./templates/1/style.css" /> Hola Ziomy :)
<!--test-->
w test.php:
<?php
?>
Chodzi o to że jeżeli napiszę <!--test--> to chcę mieć wartość test.php .
Lecz kiedy wchodzę w przeglądarkę to jak dam w test.php naprzykład:"test" to wyświetli się test , a jak dam
<?php
?>
To nie ma tego (IMG:
http://forum.php.pl/style_emoticons/default/sad.gif) .
Co mogę zrobić?