View previous topic :: View next topic |
Author |
Message |
kuepper Smarty n00b
Joined: 15 Dec 2004 Posts: 4
|
Posted: Wed Dec 15, 2004 2:16 am Post subject: Installation Question |
|
|
Hey,
I got this error just after installing Smarty:
Code: | Warning: Smarty error: unable to read resource: "index.tpl" in /home/chartse/public_html/smarty/Smarty.class.php on line 1088 |
Do I have to define these directories somewhere? I read this on the forum somewhere:
Quote: | Then instanciate your $smarty in a /home/users/mysite/config.php that also configures all paths like $smarty->template_dir, $smarty->compile_dir etc. Let all your pages below the document root include this config.php to get the $smarty instance. |
How would I do this exactly?
Here's my current configuration:
/www/smarty/*
/www/smarty/internals/*
/www/smarty/plugins/*
/www/templates/
/www/templates_c/
/www/cache/
I would greatly appreciate any help! Thanks![/code] |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed Dec 15, 2004 9:13 am Post subject: |
|
|
$smarty->template_dir = '/www/templates';
and then put an index.tpl inside /www/templates |
|
Back to top |
|
kuepper Smarty n00b
Joined: 15 Dec 2004 Posts: 4
|
Posted: Wed Dec 15, 2004 5:54 pm Post subject: |
|
|
messju wrote: | $smarty->template_dir = '/www/templates';
and then put an index.tpl inside /www/templates |
Thanks for the reply. I added the line of code you suggested to my index.php file located in /www/, so it now looks like this:
Code: |
<?php
// load Smarty library
require('./smarty/Smarty.class.php');
$smarty = new Smarty;
$smarty->template_dir = '/www/templates/';
$smarty->compile_dir = '/www/templates_c/';
$smarty->config_dir = '/www/configs/';
$smarty->cache_dir = '/www/cache/';
$smarty->assign('name','Ned');
$smarty->display('index.tpl');
?>
|
And I put the index.tpl file in the directory that you specified /www/templates/, and I still get the same error. Any ideas?
Thanks! |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed Dec 15, 2004 6:16 pm Post subject: |
|
|
you error message says "/home/chartse/public_html/" but your example says "/www/" ?? |
|
Back to top |
|
kuepper Smarty n00b
Joined: 15 Dec 2004 Posts: 4
|
Posted: Thu Dec 16, 2004 6:43 pm Post subject: |
|
|
Hmm, yes, that's what I have and that's the error message I got. I'll try changing the /www/ to /public_html/ later today and see if that does the trick. Here's a link to the error: http://chartsetups.com/index.php .
Thanks! |
|
Back to top |
|
kuepper Smarty n00b
Joined: 15 Dec 2004 Posts: 4
|
Posted: Fri Dec 17, 2004 3:55 am Post subject: |
|
|
I tried changing it to:
Code: |
<?php
// load Smarty library
require('./smarty/Smarty.class.php');
$smarty = new Smarty;
$smarty->template_dir = '/public_html/templates/';
$smarty->compile_dir = '/public_html/templates_c/';
$smarty->config_dir = '/public_html/configs/';
$smarty->cache_dir = '/public_html/cache/';
$smarty->assign('name','Ned');
$smarty->display('index.tpl');
?>
|
... and it still gives me the same message. Any ideas??
Thanks! |
|
Back to top |
|
Duncan Smarty Pro
Joined: 16 Dec 2003 Posts: 166
|
Posted: Fri Dec 17, 2004 6:05 am Post subject: |
|
|
Try using absolute paths instead:
Code: |
...
$smarty->template_dir = '/home/chartse/public_html/templates/';
$smarty->compile_dir = '/home/chartse/public_html/templates_c/';
$smarty->config_dir = '/home/chartse/public_html/configs/';
$smarty->cache_dir = '/home/chartse/public_html/cache/';
...
|
Also make sure that those dirs actually exist and are writeable by the webserver (templates_c and cache).
I'd recommend going through the crash course and reading up on the installation on smarty, which will help you out here. |
|
Back to top |
|
|