michael: smarty und dateipfade beim einbinden

hallo alle zusammen,

ich mach gerade meine ersten gehversuche mit smarty und will mir einen konstruktor bauen, der beim aufruf einer neuen smarty-instanz automatisch template-,config- und cache-dirs einbaut.

leider klappt das vorn und hinten mit dem pfad nicht... und mir will einfach nicht in den kopf wiso !!

auf meinem server sieht die smarty struktur aus wie folgt: castor:/www/_smarty_guestbook/_smarty # ls -l total 0 drwxr-xr-x    7 jflash   users         184 Sep 28 01:18 . drwxrwxrwx    4 jflash   users         168 Sep 28 12:13 .. drwxrwxrwx    2 jflash   users          48 Sep 27 23:31 cache drwxrwxrwx    2 jflash   users          48 Sep 27 23:31 configs drwxr-xr-x    4 jflash   users         248 Sep 28 01:18 libs drwxrwxrwx    2 jflash   users          80 Sep 28 01:34 templates drwxrwxrwx    2 jflash   users          96 Sep 28 12:08 templates_c castor:/www/_smarty_guestbook/_smarty #

und ich versuche es einzubinden mit (DOC_ROOT ist eine konstante, die ich vorher definiert habe):

require(DOC_ROOT."/_smarty/libs/Smarty.class.php"); require(DOC_ROOT."/_language/de.lang.php");

$smarty = new Smarty;

class MySmarty extends Smarty { function MySmarty() {  $this->Smarty();  $this->template_dir = "/www/_smarty_guestbook/_smarty/templates/";  $this->compile_dir = "/www/_smarty_guestbook/_smarty/templates_c/";  $this->config_dir = "/www/_smarty_guestbook/_smarty/configs/";  $this->cache_dir = "/www/_smarty_guestbook/_smarty/cache/";   }  }

die pfade stimmen doch ?! stattdesen kommt nur ein : Fatal error: Smarty error: the $compile_dir 'templates_c' does not exist, or is not a directory. in /www/_smarty_guestbook/_smarty/libs/Smarty.class.php on line 1084

will mir nicht so ganz in den kopf? überseh ich irgendwas?

vielen dank für eure hilfe, michael

  1. Fatal error: Smarty error: the $compile_dir 'templates_c' does not exist, or is not a directory. in /www/_smarty_guestbook/_smarty/libs/Smarty.class.php on line 1084

    will mir nicht so ganz in den kopf?
    überseh ich irgendwas?

    Die Fehlermeldung sagt recht genau, was Smarty noch braucht:
    ein Verzeichnis templates_c, wo es seine aufbereiteten Templates
    abstellt.

    Michael

    1. hi namensvetter....,

      Die Fehlermeldung sagt recht genau, was Smarty noch braucht:
      ein Verzeichnis templates_c, wo es seine aufbereiteten Templates
      abstellt.

      aber genau das ist doch da:
      drwxrwxrwx    2 jflash   users          96 Sep 28 12:08 templates_c
      castor:/www/_smarty_guestbook/_smarty #

      grüße,
      michael

      1. aber genau das ist doch da:
        drwxrwxrwx    2 jflash   users          96 Sep 28 12:08 templates_c
        castor:/www/_smarty_guestbook/_smarty #

        Sorry, ich hatte da nicht so genau hingeguckt.
        Ich poste dir die Konfiguration, wie ich sie auf meinem Server benutze. Vielleicht hilft dir das irgendwie weiter, mir fällt
        sonst auch nichts weiter auf.

        <?PHP

        define ("T_BASEPATH", -- DOCROOT --);
        define ("T_CONFPATH", T_BASEPATH."/etc/");
        define ("T_TPLPATH", T_BASEPATH."/templates/");
        define ("T_SMARTYPATH", T_BASEPATH."/smarty/libs/");

        require_once(RIA_SMARTYPATH."Smarty.class.php");

        class my_smarty extends Smarty
        {
            function my_smarty ()
            {
                $this->template_dir = T_TPLPATH;
                $this->compile_dir = T_BASEPATH."/templates_c";
                $this->config_dir = T_CONFPATH;
                $this->force_compile = true;
            }
        }

        ?>

        <?PHP

        /* Instanzierung */

        $template = new my_smarty;

        .
        .
        .

        ?>