Forum Moderators: coopster

Message Too Old, No Replies

how to include smarty class

how to include smarty class

         

phparion

7:09 pm on Mar 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I am facing include path problem while including Smarty Class.

I have installed php environment using PHPTRAID. my smarty folder resides in

Code:
C:/apache/htdocs/smarty

when i browse
Code:
[localhost...]

it doesn't give me any error. I have a page that tries to include smarty, this page resides in

Code:
C:/apache/htdocs/project/lib.inc.php
here is the code i am using,

# Filename: libs.inc.php

PHP Code:
# the exact path is defined.
$fixpath = dirname(__FILE__);

# changes this value according to your uploaded smarty distribution.
# don't forget to add trailing back slash
# change 'username' to your username on web hosting account

define ("SMARTY_DIR", "localhost/root/smarty/");

require_once (SMARTY_DIR."Smarty.class.php");
$smarty = new Smarty;
$smarty->compile_dir = "$fixpath/compile";
$smarty->template_dir = "$fixpath/html";

i have picked this code from a Smarty Tutorial.

but this code displays error,

Code:
Fatal error: Failed opening required '/root/smarty/Smarty.class.php'

(include_path='.;c:\apache\htdocs\opm\include;c:\apache\htdocs\ezt\include;C:/apache/htdocs/project')

in c:\apache\htdocs\project\libs.inc.php on line 13

i also tried

ini_set("include_path",
ini_get("include_path") . "C:/apache/htdocs/smarty");

ini_set("include_path",
ini_get("include_path") . "http://localhost/smarty");

but nothing is working and am getting the same error.

i have some doubt in tutorial where he uses USERNAME like,

PHP Code:
define ("SMARTY_DIR", "localhost/root/smarty/");

please guide me in solving this problem.

coopster

11:57 pm on Mar 20, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I'm not a Smarty user but I think you are supposed to change that CONSTANT to your smarty path if I understand the comment correctly:
define ("SMARTY_DIR", "C:/apache/htdocs/smarty/");