|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
cditty Smarty Rookie
Joined: 13 May 2003 Posts: 15
|
Posted: Sat Feb 14, 2004 3:55 am Post subject: Unable to find template |
|
|
For some reason, I can't get smarty to find that referenced template. I have smarty working correctly on another project on the same machine.
This is my first attempt at setting this up outside of our complicated setup.
Here is my config file. Code: | <?
// Configuration
$config['smarty_install'] = "/home/path/to/Smarty/"; // Where the Smarty files are installed
$config['app_base_path'] = "/home/path/to/custom_scripts/smarty/"; // Where your application is stored
// load Smarty library files
define('SMARTY_DIR',$config['smarty_install']);
require(SMARTY_DIR.'Smarty.class.php');
define('BASE_PATH', $config['app_base_path']);
class smart_template extends Smarty {
function smart_template() {
$this->Smarty();
/* tell smarty where yer template directories are */
$this->template_dir = BASE_PATH.'./';
$this->compile_dir = BASE_PATH.'./';
$this->config_dir = BASE_PATH.'./';
$this->cache_dir = BASE_PATH.'./';
/* enable caching globaly */
/* $this->caching = true; */
/* force recompile for development */
$this->force_compile = true;
/* change the default delimiters so css and javascript don't bother the template engine */
$this->left_delimiter = "{";
$this->right_delimiter = "}";
}
}
?> |
This is the smarty file Code: | <?
include("config.inc.php");
// create object
$smarty = new Smarty;
// assign some content. This would typically come from
// a database or other source, but we'll use static
// values for the purpose of this example.
$smarty->assign('name', 'george smith');
$smarty->assign('address', '45th & Harris');
// display it
$smarty->display('input.tpl');
?> |
This is the template file Code: | {*Smarty Page*}
{*input.tpl*}
{debug}
{$name}<br>
{$address}<br>
|
All the files are in the same directory. I know this is something really simple, but I can't figure it out. The error that I am getting is
Quote: | Warning: Smarty error: unable to read template resource: "input.tpl" |
Someone please point me to the error of my ways.
Thanks
Chris |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Sat Feb 14, 2004 10:05 am Post subject: Re: Unable to find template |
|
|
cditty wrote: | $this->template_dir = BASE_PATH.'./';
$this->compile_dir = BASE_PATH.'./';
$this->config_dir = BASE_PATH.'./';
$this->cache_dir = BASE_PATH.'./';
|
I don't think you want to confiure the same dir for all these. (And by the way, the 4 directory-names above don't need a trailing slash, It shouldn't do any harm if it's there, but it's not needed) |
|
Back to top |
|
cditty Smarty Rookie
Joined: 13 May 2003 Posts: 15
|
Posted: Sat Feb 14, 2004 5:14 pm Post subject: |
|
|
I only did it that way to get me up and going quickly. I have since changed the config settings to subdirectories within that directory. Same error.
Chris |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|