Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Problem with non-existent class

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup
View previous topic :: View next topic  
Author Message
Seoman
Smarty Rookie


Joined: 16 Oct 2003
Posts: 6

PostPosted: Thu Oct 16, 2003 7:57 pm    Post subject: Problem with non-existent class Reply with quote

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
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu Oct 16, 2003 8:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
Seoman
Smarty Rookie


Joined: 16 Oct 2003
Posts: 6

PostPosted: Thu Oct 16, 2003 8:06 pm    Post subject: Reply with quote

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
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu Oct 16, 2003 8:09 pm    Post subject: Reply with quote

See the second point in my last message Wink
Back to top
View user's profile Send private message
Seoman
Smarty Rookie


Joined: 16 Oct 2003
Posts: 6

PostPosted: Thu Oct 16, 2003 8:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu Oct 16, 2003 8:23 pm    Post subject: Reply with quote

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
View user's profile Send private message
Seoman
Smarty Rookie


Joined: 16 Oct 2003
Posts: 6

PostPosted: Thu Oct 16, 2003 8:31 pm    Post subject: Reply with quote

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
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu Oct 16, 2003 9:51 pm    Post subject: Reply with quote

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
View user's profile Send private message
Seoman
Smarty Rookie


Joined: 16 Oct 2003
Posts: 6

PostPosted: Fri Oct 17, 2003 7:11 am    Post subject: Reply with quote

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
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Fri Oct 17, 2003 7:20 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Seoman
Smarty Rookie


Joined: 16 Oct 2003
Posts: 6

PostPosted: Fri Oct 17, 2003 7:36 am    Post subject: Reply with quote

thanks, it works now
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP