Jump to content
InvisionCommunity.de - Der Deutsche Invision Community Support
Sign in to follow this  
Silaz

Include funzt nicht bei einem Script

Recommended Posts

Chellas,

Ich dachte ich schreibs mal hier hinein auf wenn es nichts mit dem IPB zu tun hat :D

Ziel ist es ein include in einer variablen zu speichern :)

Die Script datei sieht wie folgt aus

<?php

#### Name of this file: features.php

#### simply parses the file "features.html", no other functions included


include("include/vars.php");

include("include/mysql.php");

include("language/$language");

require("include/functions.php");



###########################

#### The features.html file              ####

###########################


$template = new MyredTemplate("html/$theme/features.php");

$template->assign("text_1", $text_1);

$template->assign("text_2", $text_2);

$template->assign("text_3", $text_3);

$template->assign("text_4", $text_4);

$template->assign("text_5", $text_5);

$template->assign("text_6", $text_6);

$template->assign("text_7", $text_7);

$template->assign("text_8", $text_8);

$template->assign("text_9", $text_9);

$template->assign("text_10", $text_10);

$template->assign("text_11", $text_11);

$template->assign("text_12", $text_12);

$template->assign("startpage", $startpage);

$template->assign("title", $pagetitle);

$template->myred_print() or die($template->error);


exit;

?>

die übergibt alles an die features.php im template verzeichnis (mit zB. {text_1} )

ich hab schon verschiedenes versucht aber leider funzt alles nichts ich möchte die datei navbox.php ins templet includen wenn ich das versuche dann bekomme ich werder fehlermeldung noch eine anzeige.

ich hoffe es war verständlich ~~~

danke

Share this post


Link to post

ich hoffe es war verständlich ~~~

Nicht wirklich. :)

Du includest diese Datei woanders rein? Wenn das der Fall ist, dann entferne mal das exit.

Share this post


Link to post

Ok ich versuch es dann mal anders zu erklären.

Also das Template ist in

/subdienst/html/standart

Die PHP datei die ausgeführt wird ist in

/subdienst

Die PHP datei die ich includen will ins template ist hier

/module/navbox.php

OK.

Oben hab ich den inhalt aus der ausführenden dateigepostet.

Da ich ins template nicht direkt includen kann suche ich einen anderen weg um das zu machen ich hatte mir der so vorgestellt das ich in die ausführende datei einfach

$navbox = include("navbox.php"); eintrage und es ausgebe mit {navbox} das funzt leider nicht da ich dann den inhalt der gesamten navbox überdem header habe.

hier ne demo

wie es aussieht wenns nicht funzt

http://www.freit-ag.de/subdienst/features.php

links müsste es so aussehen wie hier

http://www.freit-ag.de

was das verständlicher?!?

(das mit dem exit hat nicht gefunzt)

EDIT/

Hier hab ich noch die Class die die templates ausgibt vielleichtg hilft es dir aj

class MyredTemplate

{

    var $error = "";                // Last error message will be stored here


    var $tags = array();            // For the tag values pairs, as defined by assign()


    function MyredTemplate($template_file)

    {

        if(!file_exists($template_file))

        {

            $this->error = "The template file $template_file does not exist.";

        }

        $this->template_file = $template_file;

    }


    function assign($tag, $value)

    {

        if(empty($tag))

        {

            $this->error = "Tag is empty";

            return(false);

        }


        $this->tags[$tag] = $value;

        return(true);

    }


    function myred_parse()

    {

        $contents = @implode("", (@file($this->template_file)));


        while(list($key, $value) = each($this->tags))

        {

            $tag = '{'.$key.'}';

            $contents = str_replace($tag, $value, $contents);

        }

        return($contents);

    }


    function myred_print()

    {

        $ret = $this->myred_parse();

        if($ret == false)

        {

            return(false);

        }

        print($ret);

        return(true);

    }

}

Edited by Silaz

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×