RE: [SMARTY] tpl, installation (forgot)

From: Date: Mon, 01 Jul 2002 22:46:52 +0000
Subject: RE: [SMARTY] tpl, installation (forgot)
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-5153@lists.php.net to get a copy of this message
Robert, I deleted the "." Thank you. Also, I just read this which made me question the second half of your statement about using "../smarty/template/ etc" when using require() in file that is already require()ed from different directory, it's important to remember that require() just replaces itself with contents of specified file, therefore any path in the specified file is relative to path of original file, NOT the require()ed one! and the same applies to any subsequently require()ed file, of course. little example - let's have directory with two files in it, "master.php" and "define.php", and its subdirectory "scripts" with "include.php" file. then, if master.php requires include.php, and include.php requires define.php, the line in include.php should look like this: require("define.php"); and not require("../define.php"); This was on the php site here: http://www.php.net/manual/en/function.require.php So, I wondered if the Smarty.class.php contents were required in the test file under the public_html/, then should I also assume that the reference in Smarty.class.php should be relative to the test file and not the place where it sits (in dir2/hro/smarty)? Anyway, so I took off the "." And got these error messages: Warning: SAFE MODE Restriction in effect. The script whose uid is 1226 is not allowed to access /users2/hro/smarty/templates_c/369 owned by uid 99 in /users2/hro/smarty/Smarty.class.php on line 1463 Warning: Smarty error: problem creating directory "/users2/hro/smarty/templates_c/369/36957455" in /users2/hro/smarty/Smarty.class.php on line 547 Warning: Smarty error: problem writing '/users2/hro/smarty/templates_c/369/36957455/0.php.' in /users2/hro/smarty/Smarty.class.php on line 547 Warning: Unable to access /users2/hro/smarty/templates_c/369/36957455/0.php in /users2/hro/smarty/Smarty.class.php on line 642 Warning: Failed opening '/users2/hro/smarty/templates_c/369/36957455/0.php' for inclusion (include_path='.:/usr/local/include/php') in /users2/hro/smarty/Smarty.class.php on line 642 Again, Robert, I greatly appreciate all of the help you've offered today....!!!!!!!!! Sincerely, Patti -----Original Message----- From: Robert Amos [mailto:bok@ausmac.net] Sent: Monday, July 01, 2002 3:30 PM To: smarty-general@lists.php.net Subject: Re: [SMARTY] tpl, installation (forgot) the ./ your putting in front of the SMARTY_DIR means that when smarty wants to load the rest of its files, it will look in the current working directory + SMARTY_DIR, which translates to public_html/dir2/hro/smarty/. in most cases you shouldn¹t need to touch the SMARTY_DIR constant, because its designed to find out where its living on its own :) the variables you will want should be the templates directories, so if your directory structure is dir2/hro/public_html/ and dir2/hro/smarty/ then you should probably set the template and compile dirs to ../smarty/templates/, etc -bok On 2/7/02 8:17 AM, Patti Ewanski banged a keyboard and produced the following weird but readable email: > Monte, Robert, > Thanks so much for being patient with me. > > I think I set up the files correctly and the directory paths. (I > think, I hope). > > This is what my Smarty.class.php file looks like now (only part > of it) > > > define('SMARTY_DIR', './dir2/hro/smarty/'); > define('DIR_SEP', DIRECTORY_SEPARATOR); > > if (!defined('SMARTY_DIR')) { > define('SMARTY_DIR', dirname(__FILE__) . DIR_SEP); > } > > define('SMARTY_PHP_PASSTHRU', 0); > define('SMARTY_PHP_QUOTE', 1); > define('SMARTY_PHP_REMOVE', 2); > define('SMARTY_PHP_ALLOW', 3); > > class Smarty > { > > /**************************************************************** > **********/ > /* BEGIN SMARTY CONFIGURATION SECTION > */ > /* Set the following config variables to your liking. > */ > /**************************************************************** > **********/ > > // public vars > var $template_dir = './dir2/hro/smarty/templates'; > // name of directory for templates > var $compile_dir = './dir2/hro/smarty/templates_c'; > // name of directory for compiled templates > var $config_dir = './dir2/hro/smarty/configs'; > // directory where config files are located > var $plugins_dir = './dir2/hro/smarty/plugins'; > // directory where plugins are kept > > > Now, my test page shoots me these errors: > > Warning: Unable to access > ./users2/hro/smarty/Smarty_Compiler.class.php in > /users2/hro/smarty/Smarty.class.php on line 1026 > > Fatal error: Failed opening required > './users2/hro/smarty/Smarty_Compiler.class.php' > (include_path='.:/usr/local/include/php') in > /users2/hro/smarty/Smarty.class.php on line 1026 > > > I looked at line 1026 and it's a function definition: > /*=============================================================== > =======*\ > Function: _compile_template() > Purpose: called to compile the templates > \*=============================================================== > =======*/ > function _compile_template($tpl_file, $template_source, > &$template_compiled) > { > require_once SMARTY_DIR.$this->compiler_class . > '.class.php'; > > $smarty_compiler = new $this->compiler_class; > > $smarty_compiler->template_dir = > $this->template_dir; > $smarty_compiler->compile_dir = $this->compile_dir; > $smarty_compiler->plugins_dir = $this->plugins_dir; > $smarty_compiler->config_dir = $this->config_dir; > $smarty_compiler->force_compile = > $this->force_compile; > $smarty_compiler->caching = $this->caching; > $smarty_compiler->php_handling = > $this->php_handling; > $smarty_compiler->left_delimiter = > $this->left_delimiter; > $smarty_compiler->right_delimiter = > $this->right_delimiter; > $smarty_compiler->_version = $this->_version; > $smarty_compiler->security = $this->security; > $smarty_compiler->secure_dir = $this->secure_dir; > $smarty_compiler->security_settings = > $this->security_settings; > $smarty_compiler->trusted_dir = $this->trusted_dir; > $smarty_compiler->_plugins = &$this->_plugins; > $smarty_compiler->_tpl_vars = &$this->_tpl_vars; > > if ($smarty_compiler->_compile_file($tpl_file, > $template_source, $template_compiled)) > return true; > else { > $this->trigger_error($smarty_compiler->_error_msg); > return false; > } > } > > > And I don't think I should be changing anything this far down in > the program.... > Maybe has to do with my definition of SMARTY_DIR in > Smarty.class.php? > > You don't have to answer all these questions right now if you are > squeezed for time..... > I truly appreciate your help. I should send you both something. I > make candles and paper mache things in my spare time.... > > :) > Patti >

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