Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Include w Klasie
DowNlOaD_
post
Post #1





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

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


a wiec tak

zrobilem swoj template engine z cache

mozna wkladac do plikow szablonu zmienne i robic ify

i mam taka funkcje w klasie:

Kod
    public function show($file)
    {
        if (!file_exists($this->cache_dir."cache.".$file))
        {
            $sname = basename($_SERVER['SCRIPT_FILENAME']);
            echo("<b>TemplateEngine Error:</b> File <b>".$this->template_dir.$file."</b> doesn't exist. Error in <b>".$sname."</b>.<br />");
            return 0;
        }
        include($this->cache_dir."cache.".$file);
    }


i jak uzywam np: show("index_body.php"); to pojawia sie tresc pliku ale zmienne z index.php nie chodza

jak to mozna naprawic?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
DowNlOaD_
post
Post #2





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

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


INDEX.PHP
Kod
<?php

include("template.php");

$logged = 1;

$t = new template;
$t->template_dir("templates/");
$t->cache_dir("cache/");
$t->convert("index_body.php");
$t->show("index_body.php");

?>


INDEX_BODY.PHP
Kod
{if=$logged == 0/}

lol

{elseif=$logged == 1/}

lol2

{/if}


//edit:

dalem $logged = 1; tylko do testow bo to nie jakis duzy moj skrypt tylko tescik template engina mojego

i pojawia sie lol zamiast lol2

Ten post edytował DowNlOaD_ 28.05.2010, 18:20:15
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 - 06:27