PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.smarty.general > Smarty engine not working
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Smarty engine not working

Réponse
 
LinkBack Outils de la discussion
Vieux 19/09/2006, 15h41   #1 (permalink)
Vignesh M.P.N.
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Smarty engine not working

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 me with this. I would highly appreciate your .

Thanks
Vignesh.

  Réponse avec citation
Vieux 19/09/2006, 15h53   #2 (permalink)
Marc Saric
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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 me with this. I would highly appreciate your .
>
> Thanks
> Vignesh.



--
Bye,

Marc Saric
  Réponse avec citation
Vieux 19/09/2006, 16h17   #3 (permalink)
Vignesh M.P.N.
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut RE: [SMARTY] Smarty engine not working

Thanks for the .

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:marc.saric@gmx.de]
Sent: Tuesday, September 19, 2006 9:53 AM
To: smarty-general@lists.php.net
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 me with this. I would highly appreciate your .
>
> Thanks
> Vignesh.



--
Bye,

Marc Saric

--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
  Réponse avec citation
Vieux 19/09/2006, 16h31   #4 (permalink)
Monte Ohrt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] Smarty engine not working

The template_dir needs read access from apache, and compile_dir needs
read/write access from apache. Your template editor person needs
read/write access to the template_dir. If you set mod 777, then anyone
on the system can read/write to that directory. This security concern
is totally up to you. ie. if you write insecure PHP code and someone
exploits that through your web server, they somehow may be able to
read/write to those directories. I like to lock things down to minimal.

Vignesh M.P.N. wrote:
> Thanks for the .
>
> 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:marc.saric@gmx.de]
> Sent: Tuesday, September 19, 2006 9:53 AM
> To: smarty-general@lists.php.net
> 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 me with this. I would highly appreciate your .
>>
>> Thanks
>> Vignesh.
>>

>
>
>

  Réponse avec citation
Vieux 19/09/2006, 16h47   #5 (permalink)
Cameron Perry
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] Smarty engine not working

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 s 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 .
>
> 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:marc.saric@gmx.de]
> Sent: Tuesday, September 19, 2006 9:53 AM
> To: smarty-general@lists.php.net
> 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 me with this. I would highly appreciate your .
>>
>> 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
>

  Réponse avec citation
Vieux 19/09/2006, 17h32   #6 (permalink)
£ukasz 'nostra' Wojciechowski
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Smarty templates syntax validation

Hello,

I'm using Smarty for a long time now for web templates. Now I started
using it for compiling e-mail templates. Now I want to give access to
user to change e-mail templates. And here comes the problem. I want to
validate template syntax before allowing its change. It's quite with
file: resource (e.g. $smarty->fetch("file:some.file.tpl"); but can't
make it working with database resource. I tried to make it working with
SmartyCompiler->_compile_file but it appears that it doesn't recognize
resource tag (e.g. "db:some.name");

I would appreciate some .

Regards,

--

£ukasz "nostra" Wojciechowski
gg.1028640 * icq.23059512
  Réponse avec citation
Vieux 23/09/2006, 22h49   #7 (permalink)
Marcus Bointon
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] Smarty templates syntax validation


On 19 Sep 2006, at 17:32, Åukasz 'nostra' Wojciechowski wrote:

> I'm using Smarty for a long time now for web templates. Now I started
> using it for compiling e-mail templates. Now I want to give access to
> user to change e-mail templates. And here comes the problem. I want to
> validate template syntax before allowing its change. It's quite with
> file: resource (e.g. $smarty->fetch("file:some.file.tpl"); but can't
> make it working with database resource. I tried to make it working
> with
> SmartyCompiler->_compile_file but it appears that it doesn't recognize
> resource tag (e.g. "db:some.name");


I have exactly the same problem! It's especially bad in that many of
these errors are fatal. The only method I've thought of so far is to
fire up a CLI instance of PHP using exec() try using the template and
see if it works, but I don't have a tidy method for doing that as yet.
At present I'm avoiding the problem using my own very restricted
template syntax - anything even slightly weird just gets ignored. It
works, but it's very limiting - it would be much nicer to use smarty.

So, if anyone comes up with a neat mechanism, I'd like to hear about
it too.

Marcus
--
Marcus Bointon
Synchromedia Limited: Creators of http://www.smartmessages.net/
marcus@synchromedia.co.uk | http://www.synchromedia.co.uk/
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 03h46.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,19050 seconds with 15 queries