Page 1 of 1

smarty template display()

Posted: Thu May 05, 2005 3:52 am
by localhost
The display function is not working
my director structure is d:\projects\websites\test
and smarty class is placed at d:\projects\websites\test\smarty
i am using smarty-2.5.0

Code: Select all

define('SMARTY_DIR',"smarty/");
if(include(SMARTY_DIR.'Smarty.class.php'))
echo "success";
$smarty = new Smarty;
$smarty->compile_check = true;
$smarty->debugging = true;
$smarty->template_dir = 'smarty/templates';
$smarty->compile_dir = 'smarty/templates_c';
$smarty->cache_dir = 'smarty/cache';
$smarty->config_dir = 'smarty/configs';
$smarty->assign('Username', 'John Doe'); 
$smarty->display('index.tpl');

Posted: Thu May 05, 2005 4:29 am
by phpScott
either put a / if front of smarty in your define or use an absolute reference to it's location.

re

Posted: Thu May 05, 2005 4:59 am
by localhost
i put the absolute path i.e

Code: Select all

include('d:projects/websites/test/smarty/Smarty.class.php');
but still it doesn't work.i am not recieving any errors but there is no out put either

Posted: Thu May 05, 2005 5:08 am
by phpScott
i think you are missing th e/ after d:

if not try

Code: Select all

define('SMARTY_DIR',"./smarty/");

Posted: Thu May 05, 2005 5:13 am
by localhost
Done that, the path i think is just fine because browser does prints success

Code: Select all

define('SMARTY_DIR',"./smarty/");
if(include(SMARTY_DIR."Smarty.class.php"))
echo "success";

Posted: Thu May 05, 2005 5:18 am
by phpScott
I haven't used smarty before so I can't help you any further. sorry :(