Re: [SMARTY] Smarty engine not working
[email protected] (Cameron Perry) Tue, 19 Sep 2006 08:47:23 -0700
| Newsgroups | php.smarty.general |
|---|---|
| Message-ID | <[email protected]> |
If you want to put the smarty directory IN your web root (your "templates" directory) I would highly suggest putting restrictions on reading via a .htaccess file with these contents: Options -Indexes Order Deny,Allow Deny from all Allow from none That will prevent people from being able to directly access your smarty files and templates (though PHP can still read them just fine). I typically put another .htaccess file within my template images directory so I can keep those together with the templates. Makes it easier to install/remove new template themes. Inside your template images directory, an .htaccess file: Options -Indexes Order Allow,Deny Allow from all Deny from none Hope this tip helps at least one person. One of the primary reasons I do it is because it makes developing themes easier, especially if you're using an app like dreamweaver. Likewise it seems to be a better solution if you're distributing your application for others to use or you want to be able to easily install additional themes. ~Cameron On Sep 19, 2006, at 8:17 AM, Vignesh M.P.N. wrote: > Thanks for the help. > > Now I set the permission to 777 and it works. I overlooked this > because in > my earlier server the permission was set "775", but the owner was > set to > "apache". > > Would you advise setting the permission as "775" and set the owner as > "apache"? > > Thanks for your security remark. Let me set the "compile_dir" as > "/templates_c" and set the permission as 777. What should be the > permission > for "/templates"? > > Thanks > Vignesh. > > -----Original Message----- > From: Marc Saric [mailto:[email protected]] > Sent: Tuesday, September 19, 2006 9:53 AM > To: [email protected] > Subject: Re: [SMARTY] Smarty engine not working > > > Hi, > > stupid question: > > Did you really set correct permissions in templates? On a bad day this > is what happens to me usually. > > What does your PHP-error-log tells you? > > One remark: Setting all Smarty dirs to "template" might pose a > security > risk, because people might be able to read raw templates etc. i.e. > stuff they normaly are not allowed to see at all... > > Vignesh M.P.N. wrote: >> 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. > > > -- > Bye, > > Marc Saric > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >