For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > September 2006 > Smarty engine not working









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Smarty engine not working
Vignesh M.P.N.

2006-09-19, 7:05 pm

Hi

The Smarty engine is not working for me. I already had a fully functioning
application using the Smarty templates. But now I moved it to a new server
and nothing working for me. As my application didn't work I tried with the
simplest sample provided in the manual, but in vain. I hope there could be
some problem with my configuration.

This is how I installed it. I copied the contents of "/lib" directory to
"/usr/share/php/smarty" wherer "usr/share/php" is in the "include_path".

I also checked the file permissions of all the relevant files with my old
server.

I am sure that "Smarty.class.php" is detected by the interpreter because
"$smarty->template_exists('test.tpl')" returns a result.

Please note "/templates" folder is in my web working directory.

The problems am facing are, none of the content from "test.tpl" is displayed
and in fact "test.tpl" is not even compiled.

Please find the code below:

test.php

<?php
require_once 'smarty/Smarty.class.php';

$smarty = new Smarty();
$smarty->template_dir = './templates';
$smarty->compile_dir = './templates';
$smarty->config_dir = './templates';
$smarty->cache_dir = './templates';

if ($smarty->template_exists('test.tpl')) {
echo 'Template exists';
}

$smarty->assign('name','Ned');
$smarty->display('test.tpl');
?>

test.tpl

{* Smarty *}

Hello {$name}, welcome to Smarty!

---------------------------------------------------

Please help me with this. I would highly appreciate your help.

Thanks
Vignesh.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com