Subdirectories and directory structure

From: Date: Tue, 27 May 2003 16:15:01 +0000
Subject: Subdirectories and directory structure
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-9603@lists.php.net to get a copy of this message
I am having trouble getting Smarty to work with files in subdirectories under the document root. The online documentation provides an example similar to what I am trying to achieve: http://smarty.php.net/manual/en/installing.smarty.extended.php. However, after modifying the example for my environment, it failed with errors "problem writing temporary file" and "unable to read template resource". I have set up the following directories and files: /home/smarty/libs/ -- Smarty libraries directory /home/htdocs/ -- web document root directory ($DOCUMENT_ROOT) /home/htdocs/index.php -- home page (works with Smarty as expected) /home/htdocs/config.php -- script to initialize environment /home/htdocs/test/index.php -- page to test Smarty directory traversal The page at test/index.php (last item above) is where I am encountering the errors. The config.php file is analogous to the setup.php file in the Smarty online documentation noted above. The home page (which works as expected) does not call the config.php file but uses the Smarty libs directly. The following is the contents of my config.php file (directories shortened for clarity): // ------------- require ("/home/smarty/libs/Smarty.class.php"); // this works class Smarty_smartytest extends Smarty { function Smarty_smartytest() {
    $this->Smarty();
    $this->template_dir = 'templates';
    $this->compile_dir = 'templates_c';
    $this->config_dir = 'configs';
    $this->cache_dir = 'cache';
    $this->caching = true;
    $this->assign('app_name','smartytest');
} } // ------------- And the following is the contents of my test/index.php file: // ------------- require ($DOCUMENT_ROOT."/config.php"); // this works $smarty = new Smarty_smartytest; $smarty->assign('name','Ned'); $smarty->display('test.tpl'); // ------------- I've tried indicating different directory paths for the various file/directory references, to no avail. My guess is that the config.php doesn't have the correct paths to the template_dir, compile_dir, config_dir, and cache_dir. I've tried several variants there but can't seem to get the correct one. (I'm not familiar with using PHP classes and objects.) Any suggestions or solutions? Thanks, - Orest -- Orest Kinasevych Saj -------------------------------- OKINA CONSULTING 170 Tierney Drive Cedar Grove, NJ 07009 USA +1 973 978-3597 U.S. +1 204 510-3597 Canada +1 877 380-0030 Tollfree & Fax -------------------------------- "Nam et ipsa scientia potestas est." - Francis Bacon (1561–1626)

« previous php.smarty.general (#9603) next »