smarty template display()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
localhost
Forum Commoner
Posts: 43
Joined: Tue Dec 07, 2004 4:52 am
Location: islamabad
Contact:

smarty template display()

Post 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');
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

either put a / if front of smarty in your define or use an absolute reference to it's location.
localhost
Forum Commoner
Posts: 43
Joined: Tue Dec 07, 2004 4:52 am
Location: islamabad
Contact:

re

Post 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
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

i think you are missing th e/ after d:

if not try

Code: Select all

define('SMARTY_DIR',"./smarty/");
localhost
Forum Commoner
Posts: 43
Joined: Tue Dec 07, 2004 4:52 am
Location: islamabad
Contact:

Post 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";
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

I haven't used smarty before so I can't help you any further. sorry :(
Post Reply