View previous topic :: View next topic |
Author |
Message |
Seoman Smarty Rookie
Joined: 16 Oct 2003 Posts: 6
|
Posted: Thu Oct 16, 2003 7:57 pm Post subject: Problem with non-existent class |
|
|
Hello,
ally my smarty files are in my smarty folder
my setup.php looks that.
Code: | define ("SMARTY_DIR" , "oa/smarty/libs/");
require_once (SMARTY_DIR."Smarty.class.php");
class smarty_template extends Smarty {
function smarty_template() {
$this -> Smarty();
$this -> use_sub_dirs = false;
$this->template_dir = 'oa/smarty/templates/';
$this->compile_dir = 'oa/smarty/templates_c/';
$this->config_dir = 'oa/smarty/configs/';
$this->cache_dir = 'oa/smarty/cache/';
}
} |
and my index.php
Code: | require ("oa/smarty/setup.php");
$smarty = new set_templates;
$smarty->display('oa/templates/index.tpl') |
this is the error, wich come:
Fatal error: Cannot instantiate non-existent class: set_templates in c:\apache\htdocs\oa\index.php on line 4
I hope you can help me |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Thu Oct 16, 2003 8:02 pm Post subject: |
|
|
According to your example (prepare youself for this), you should instantiate smarty with:
[php:1:4608199204]$smarty = new smarty_template;[/php:1:4608199204]
Not related to your error, but I strongly suggest that you use absolute paths when setting up Smarty, if at all possible.
HTH |
|
Back to top |
|
Seoman Smarty Rookie
Joined: 16 Oct 2003 Posts: 6
|
Posted: Thu Oct 16, 2003 8:06 pm Post subject: |
|
|
I changed this and this is the next error
Warning: Smarty error: unable to read resource: "oa/templates/index.tpl" in c:\apache\htdocs\oa\smarty\libs\Smarty.class.php on line 1143 |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Thu Oct 16, 2003 8:09 pm Post subject: |
|
|
See the second point in my last message |
|
Back to top |
|
Seoman Smarty Rookie
Joined: 16 Oct 2003 Posts: 6
|
Posted: Thu Oct 16, 2003 8:15 pm Post subject: |
|
|
i found the last error, but when I changed it, this Erorr comes
Fatal error: Smarty error: the $compile_dir 'oa/smarty/templates_c/' does not exist, or is not a directory. in c:\apache\htdocs\oa\smarty\libs\Smarty.class.php on line 1143
the paths to the directory are right, but I don't know, why this error come. |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Thu Oct 16, 2003 8:23 pm Post subject: |
|
|
Okay, you are evidently using Windows, so now I emphasize my last point:
USE ABSOLUTE PATHS.
No kidding, it will save you tons of headaches.
eg:
define('SMARTY_DIR', 'c:\\path\\to\\smarty\\');
....
$this->template_dir = SMARTY_DIR . 'templates';
etc.
HTH |
|
Back to top |
|
Seoman Smarty Rookie
Joined: 16 Oct 2003 Posts: 6
|
Posted: Thu Oct 16, 2003 8:31 pm Post subject: |
|
|
ok,
Parse error: parse error, unexpected T_STRING in c:\apache\htdocs\oa\smarty\setup.php on line 4
Fatal error: Cannot instantiate non-existent class: smarty_template in c:\apache\htdocs\oa\index.php on line 4required 'c:\apache\htdocs\oa\smarty\seup.php' (include_path='.; \apache\includes;\apache\htdocs\;\apache\htdocs\phpmyadmin') in c:\apache\htdocs\oa\index.php on line 3 |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Thu Oct 16, 2003 9:51 pm Post subject: |
|
|
Seoman wrote: | Parse error: parse error, unexpected T_STRING in c:\apache\htdocs\oa\smarty\setup.php on line 4 |
Sorry, that is a problem in your code. |
|
Back to top |
|
Seoman Smarty Rookie
Joined: 16 Oct 2003 Posts: 6
|
Posted: Fri Oct 17, 2003 7:11 am Post subject: |
|
|
my setup.php looks now that
Code: | <?php
define ("SMARTY_DIR" , "c:\\apache\htdocs\oa\smarty\libs\");
require_once (SMARTY_DIR."Smarty.class.php");
class smarty_template extends Smarty {
function smarty_template() {
$this -> Smarty();
$this -> use_sub_dirs = false;
$this->template_dir = 'c:\\apache\htdocs\oa\smarty\template\\';
$this->compile_dir = 'c:\\apache\htdocs\oa\smarty\templates_c\';
$this->config_dir = 'c:\\apache\htdocs\oa\smarty\templates_c\';
$this->cache_dir = 'c:\\apache\htdocs\oa\smarty\templates_c\';
}
}
?> |
|
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Fri Oct 17, 2003 7:20 am Post subject: |
|
|
Seoman wrote: |
Code: |
define ("SMARTY_DIR" , "c:\\apache\htdocs\oa\smarty\libs\");
|
|
your "\" should be "\\" actually. please see the php-manual how to quote stuff inside strings. |
|
Back to top |
|
Seoman Smarty Rookie
Joined: 16 Oct 2003 Posts: 6
|
Posted: Fri Oct 17, 2003 7:36 am Post subject: |
|
|
thanks, it works now |
|
Back to top |
|
|