Re: Strange Errors

From: Date: Wed, 22 Sep 2004 10:32:45 +0000
Subject: Re: Strange Errors
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-11816@lists.php.net to get a copy of this message
Hello Ricardo Cezar, I had the same problem when the first time I used Smarty. I think your problem is in your php.ini that you haven't set your include_path correctly. Please check this line : ; Windows: "\path1;\path2" then u write below that (for example like in my WinXP Pro): include_path=".;C:\php\pear\smarty" I put smarty library in that folder. But when I put my website into hosting (Linux), and they told me that they can't change their include_path at their hosting, so I must upload smarty library myself to my space. For security reasons, we can set .htaccess or we can put smarty library not in folder /www And change the name of template/template_c/config directories to our language (just to make it strange 4 general people) or even special regional language that we got so many in Indonesia, like Banjar for Banjarnese (Borneo), or Bali for Balinese (Near Java), for example in hosting we can use this : <? ## config.inc.php if ( ereg("config.inc.php", $PHP_SELF) ) { header("location: index.php"); die; } ## konfigurasi smarty define(LIB_DIR, "/home/myusername/semelati"); // actually this is smarty library define(TPL_DIR, "/home/myusername/semelati_tpl"); // actually this is my template directory define(CPL_DIR, "/home/myusername/semelati_cpl"); // actually this is my template_c directory include(LIB_DIR."Smarty.class.php"); $smarty = new Smarty; $smarty->template_dir = TPL_DIR; $smarty->compile_dir = CPL_DIR; ?> So when we wanna display Hello {$nama} I just use this in fileindex.php <? include "config.inc.php"; $smarty->assign('nama', 'Ari Keren'); $smarty->display('hello.tpl'); ?> For others, is there any other ways to secure website concerning using Smarty ? Best Regards, Arie Kusuma Atmaja www.riyari.com Semarang - Central Java - Indonesia > Message-ID: <20040921192207.15864.qmail@pb1.pair.com> > To: smarty-general@lists.php.net > From: "Ricardo Cezar" <hosptalab@wnet.com.br> > Date: Tue, 21 Sep 2004 13:59:43 -0300 > Subject: Strange Errors > > I´m beggining my very first Smarty website, but I´m running into strange > errors. Can you help me telling what I´m doing wrong? > > The errors are as folows: > ======================== > Warning: Smarty::fetch(templates_c/\%%B7^B78^B78219F0%%teste.tpl.php) > [function.fetch]: failed to open stream: No such file or directory in > c:\wamp\www\anuncioscomfotos\smarty\Smarty.class.php on line 1248 > > Warning: Smarty::fetch() [function.include]: Failed opening > 'templates_c/\%%B7^B78^B78219F0%%teste.tpl.php' for inclusion > (include_path='C:\wamp\php\PEAR') in > c:\wamp\www\anuncioscomfotos\smarty\Smarty.class.php on line 1248 > ======================== > > And here my website structure and files: > > ======================== > > C:\wamp\www\anuncioscomfotos\smarty (the libs directory) > > C:\wamp\www\anuncioscomfotos\templates > C:\wamp\www\anuncioscomfotos\templates_c > C:\wamp\www\anuncioscomfotos\configs > C:\wamp\www\anuncioscomfotos\cache > > C:\wamp\www\anuncioscomfotos\setup.php > > C:\wamp\www\anuncioscomfotos\templates\teste.tpl > > C:\wamp\www\anuncioscomfotos\teste.php > > > ====== setup.php ====== > > <?php > > require("smarty/Smarty.class.php"); > > class MySmarty extends Smarty { > > function MySmarty() > { > $this->Smarty(); > > $this->template_dir = "templates/"; > $this->compile_dir = "templates_c/"; > $this->config_dir = "configs/"; > $this->cache_dir = "cache/"; > > $this->cacheing = true; > $this->assign("app_name", "Anúncios Com Fotos"); > } > } > > ?> > ======================= > > ====== teste.php ====== > > <?php > > require('setup.php'); > $smarty = new MySmarty; > $smarty->assign('name', 'Ned'); > $smarty->display('teste.tpl'); > > ?> > > ======================= > > ====== teste.tpl ====== > > {* Smarty *} > > Hello, {$name}! > > ======================= >

« previous php.smarty.general (#11816) next »