|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
retiman Smarty n00b
Joined: 25 Oct 2004 Posts: 3
|
Posted: Mon Oct 25, 2004 11:08 pm Post subject: unable to read resource.. works on win32 not linux |
|
|
Hi. I am having a problem similar to one people have posted many times, but after trying all the suggestions outlined in the forum, I am still having the same problem.
I have smarty set up in:
/home/minhuang/minformix.org/html/blog/smarty/
My 4 smarty directories are:
/home/minhuang/minformix.org/html/blog/templates/
/home/minhuang/minformix.org/html/blog/templates_c/
/home/minhuang/minformix.org/html/blog/configs/
/home/minhuang/minformix.org/html/blog/cache/
The templates_c and cache directories are owned by www-data and have been chmod'ed to 777 for testing purposes.
I have extended the smarty class in Smarty_Blog.php:
Code: |
<?php
$root = getenv("DOCUMENT_ROOT");
define("SMARTY_DIR", "$root/blog/smarty/");
require_once(SMARTY_DIR . "Smarty.class.php");
class Smarty_Blog extends Smarty {
var $template_dir;
var $compile_dir;
var $config_dir;
var $cache_dir;
function Smarty_Blog() {
global $root;
$this->Smarty();
$this->template_dir = "$root/blog/templates/";
$this->compile_dir = "$root/blog/templates_c/";
$this->config_dir = "$root/blog/configs/";
$this->cache_dir = "$root/blog/cache/";
$this->caching = false;
}
}
?>
|
And my index file looks like this:
Code: |
<?php
include_once("Smarty_Blog.php");
$smarty = new Smarty_Blog();
$smarty->display("index.tpl");
?>
|
I can't get this to work in linux. I get the following error:
[Mon Oct 25 16:00:27 2004] [error] PHP Warning: Smarty error: unable to read resource: "index.tpl" in /home/minhuang/minformix.org/html/blog/smarty/Smarty.class.php on line 1088
The strange thing is that I have the exact same setup with WAMP, and it works fine. I just can't get it to work remotely. Does anybody have any advice? |
|
Back to top |
|
retiman Smarty n00b
Joined: 25 Oct 2004 Posts: 3
|
Posted: Mon Oct 25, 2004 11:13 pm Post subject: |
|
|
OK, so I just moved all my tpl files into the smarty directory, and in my Smarty_Blog class, I changed the template_dir variable to the directory I installed Smarty in, and it works!
Maybe this will be helpful to somebody, but does anybody know why it works like this? |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Mon Oct 25, 2004 11:34 pm Post subject: |
|
|
I'd hazzard to guess that either you didn't copy the files over to the correct directories or permissions are not set correctly. Importantly, do not copy the tempory files from one machine to another (ie: files in templates_c/ and cache/) |
|
Back to top |
|
retiman Smarty n00b
Joined: 25 Oct 2004 Posts: 3
|
Posted: Tue Oct 26, 2004 12:47 am Post subject: |
|
|
I set the permissions thusly:
The templates dir was chowned to www-data (web user) and chmod'ed to 777 (more permission than even necessary), and although I copied files from templates_c and cache over, I'm not sure how that would produce the error I was getting. At any rate, I had also tried deleting all the files in those directories too...
Oh well, at least it works now |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|