View previous topic :: View next topic |
Author |
Message |
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Sat Jul 19, 2003 10:09 pm Post subject: |
|
|
Hi Häakon.
Wow, I must say, that sure does look correct!
I'm assuming you are using 2.5.0 and that you are using PHP as an Apache mod. When you created the templates_c and cache directories (you already said that you made no spelling errors, so I assume that your code matches your exact dir structure) did you change the ownerships appropriately for the user that your webserver process uses to access those files?
The most telling piece of evidence is the error message you posted:
Quote: | Warning: unable to create file /^home^showchoir^smarty^schools^templates^index.tpl because Permission denied in /home/virtual/site122/fst/var/www/html/require/Smarty/Smarty.class.php on line 1575 |
As you already figured out, this really does mean that you have a directory configuration issue as far as Smarty is concerned. As a test, try setting them to 777 and see if that doesn't work. Obviously, that is not suitable for a final solution, but....
As a humourous aside, having HTML code embedded in your PHP file goes against the principal of separation that Smarty is trying to foster. I'm sure that would be far clearer if Smarty would actually work for you .
ps. I like your handle--it reminds me of a hockey player (and the hacking reference is cool) |
|
Back to top |
|
Häakon Smarty Rookie
Joined: 19 Jul 2003 Posts: 18 Location: San Diego, California
|
Posted: Sat Jul 19, 2003 10:50 pm Post subject: |
|
|
Yes to the 2.5.0 and the Apache mod.
I'll tell you right now that I purchase web hosting space from a company (as I'm sure a lot of people do), but I'm not running this on my home computer or anything, so my "ownership" controls are limited. I have the capacity to CHMOD files through my FTP client, but I can't change "owners." When I created the directories, they're apparently owned by "showchoir" (my user). I called up their tech support, who have been very good at handling problems, and he said that only root is allowed to change the owners, and with a buch of different clients on their server, obviously I'm not going to be given that access. He did, however, change ownership of the directories to "nobody." (He did this to only "cache" and "templates_c" at first, and when that had no effect, he did it to the other two just in case).
I will admit that I am quite new to PHP so I'm not trying to sound like the pestering newbie, but I do think I've followed the instructions just as they are written and I'm not sure how to get around this one. If you'd like, I can give you access to my server and you can take a look around to see if there's something I've done wrong... but at this point I'm just pulling my hair out!
As for the HTML code embedded in my PHP file... I guess that's why I'm over here trying to get Smarty to run in the first place. I was having a problem with a php file I made, and I went on IRC to get some help... and they just laughed at me and said I should be using Smarty. So here I am. Except I can't get this damn thing working either.
My name is Häakon, actually... so it's not a hacking reference or shout out to a hockey player - intentionally, anyway. |
|
Back to top |
|
atpower Smarty Rookie
Joined: 23 Jul 2003 Posts: 6
|
Posted: Wed Jul 23, 2003 8:30 am Post subject: |
|
|
I have the same problem. |
|
Back to top |
|
atpower Smarty Rookie
Joined: 23 Jul 2003 Posts: 6
|
Posted: Wed Jul 23, 2003 9:06 am Post subject: |
|
|
I have just fixed the problem by omit the define of $template_dir and $compile_dir and etc. Additionally I set up Dirs like <templates> and <templates_c> as default ,then copy *.tpl to <templates> ,it works! |
|
Back to top |
|
mOsEz Smarty n00b
Joined: 05 Aug 2003 Posts: 4 Location: Geesthacht, Germany
|
Posted: Tue Aug 05, 2003 10:25 pm Post subject: |
|
|
hi... i am new at using smarty and i have got the same problem...
my failure message:
Code: | Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/%%117/%%1172603085/index.tpl.php) is not within the allowed path(s): (/www/htdocs/v081952/) in /www/htdocs/v081952/libs/Smarty.class.php on line 1520
Warning: Smarty error: unable to read template resource: "index.tpl" in /www/htdocs/v081952/libs/Smarty.class.php on line 1042 |
and this is my index.php:
Code: | <?php
require('/www/htdocs/v081952/libs/Smarty.class.php');
$smarty = new Smarty;
$smarty->template_dir = ('/www/htdocs/v081952/libs/test/templates/');
$smarty->compile_dir = ('/www/htdocs/v081952/libs/test/templates_c/');
$smarty->config_dir = ('/www/htdocs/v081952/libs/test/configs/');
$smarty->cache_dir = ('/www/htdocs/v081952/libs/test/cache/');
$smarty->assign('name','Ned');
$smarty->display('index.tpl');
?> |
and my index.tpl:
Code: | {* Smarty *}
Hallo, {$name}! |
the files are at the place where the path shows...
for testing i has set the chmod for every directory to 777 and it doesnt work
i dont know what is wrong, please help me!
p.s. sorry for my bad english...
_________________ greetz mOsEz
Last edited by mOsEz on Wed Aug 06, 2003 9:54 am; edited 1 time in total |
|
Back to top |
|
mOsEz Smarty n00b
Joined: 05 Aug 2003 Posts: 4 Location: Geesthacht, Germany
|
|
Back to top |
|
Häakon Smarty Rookie
Joined: 19 Jul 2003 Posts: 18 Location: San Diego, California
|
Posted: Sat Aug 09, 2003 5:59 pm Post subject: |
|
|
atpower wrote: | I have just fixed the problem by omit the define of $template_dir and $compile_dir and etc. Additionally I set up Dirs like <templates> and <templates_c> as default ,then copy *.tpl to <templates> ,it works! |
Would you mind explaining this a little further? I've been working on this for a month now, and I still can't even install it... |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Mon Aug 11, 2003 3:56 am Post subject: |
|
|
Hi Haakon.
I know you are still looking for some tips, though to be honest, I'm getting a bit thin on suggestions. What happens if you do this:
Code: | $smarty->display('index.tpl'); |
? |
|
Back to top |
|
Häakon Smarty Rookie
Joined: 19 Jul 2003 Posts: 18 Location: San Diego, California
|
Posted: Mon Aug 11, 2003 4:18 am Post subject: |
|
|
I get the single error:
Warning: Smarty error: unable to read template resource: "index.tpl" in /home/virtual/site122/fst/var/www/html/require/Smarty/Smarty.class.php on line 1042 |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Mon Aug 11, 2003 6:54 pm Post subject: |
|
|
Häakon wrote: | I get the single error:
Warning: Smarty error: unable to read template resource: "index.tpl" in /home/virtual/site122/fst/var/www/html/require/Smarty/Smarty.class.php on line 1042 |
Now that shouldn't be. Your template should be locatable via your line:
[php:1:86db0d63fd]$smarty->template_dir = '/home/showchoir/smarty/schools/templates';[/php:1:86db0d63fd]
and I would expect your index.tpl to be located in /home/showchoir/smarty/schools/templates.
I notice that you are using PHP 4.06. I take it that it is supported, by it is a bit dated and since I'm grasping at straws--is there any chance it can be upgraded? Does anyone have any ideas for Haakon? |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Thu Aug 21, 2003 2:29 am Post subject: |
|
|
By-the-way, haakon, are any files being written to your /home/showchoir/smarty/schools/templates directory? If not, then perhaps your host doesn't permit write access to directories (except by ftp, perhaps?). |
|
Back to top |
|
Häakon Smarty Rookie
Joined: 19 Jul 2003 Posts: 18 Location: San Diego, California
|
Posted: Wed Sep 03, 2003 12:27 am Post subject: |
|
|
Just to let you know (in case anyone was still trying to figure this out), I finally gave up and switched webhosts. I installed smarty on my new host and it works just fine. I went back to the old host (which is still active, for the time being) and I still have no idea what's wrong with it. I retraced my steps completely and can't figure it out. So, the end of this is that I never got it to work on my original host, but it is working now on my new one. I hate it when I can't figure out the reasons why things don't work, but at least I have a functional version... and at this point, that's all I really care about. Thanks to everyone who tried to provide assitance. |
|
Back to top |
|
wingoffire Smarty n00b
Joined: 05 Sep 2003 Posts: 1
|
Posted: Fri Sep 05, 2003 10:47 am Post subject: Oh~~I got the same problem in my code |
|
|
I do some think like document said,but I got the problem above
I'm under WindowsXp Apache with php module install~~
here is my code and the file position
d:\newtorock\classes\userTemplate.php
Quote: |
// TARZAN_ROOT_PATH is "d:/newtorock"
class UserTemplate extends Smarty {
function UserTemplate(){
$this->Smarty();
$this->template_dir = TARZAN_ROOT_PATH.'/templates/user/';
$this->compile_dir = TARZAN_ROOT_PATH.'/templates_c/user/';
$this->config_dir = TARZAN_ROOT_PATH.'/configs/user/';
$this->cache_dir = TARZAN_ROOT_PATH.'/cache/user/';
$this->caching = true;
}
}
|
templat file: d:\newtorock\templates\user\userInfo.tpl
Quote: |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>{$user->getUserName()}</title>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" summary="">
<tr>
<td>userName:{$user->getUserName()}</td>
<td>userNo:{$user->getUserNo()}</td>
<td>password:{$user->getPassword()}</td>
</tr>
</table>
</body>
</html>
|
testfile: d:\newtorock\test.php if I wrote it like below ,Smarty wroks good!
Quote: |
//..................get $user object....................
$tpl = new Smarty();
$tpl->template_dir=TARZAN_ROOT_PATH."/templates/user/";
$tpl->assign('user',$user);
$tpl->display("userInfo.tpl");
|
but if I wrote in another way ...
Quote: |
//..................get $user object....................
$tpl = new UserTemplate();
$tpl->assign('user',$user);
$tpl->display("userInfo.tpl");
|
the error is
Quote: |
Warning: Failed opening '\%%433\%%433950399\userInfo.tpl.php' for inclusion (include_path='.;c:\php4\pear') in d:\newTorock\libs\Smarty.class.php on line 1164
and sometime it will become
Warning: Smarty error: unable to read template resource: "index.tpl" in d:\newTorock\libs\Smarty.class.php on line 1042
|
My PHP is 4.3.3RC
anyone can help me? thanks |
|
Back to top |
|
Orestis Smarty n00b
Joined: 23 Sep 2003 Posts: 1
|
Posted: Tue Sep 23, 2003 8:54 am Post subject: unable to read ... bla bla |
|
|
Hi @ all
got the same prob and solved it!!!
Smarty version 2.5.0
Line 52:
[php:1:c319a4d53f]define('DIR_SEP', DIRECTORY_SEPARATOR);[/php:1:c319a4d53f]
Define in your php-script this DIRECTORY_SEPARATOR
[php:1:c319a4d53f]define('SMARTY_DIR', "/home/php/public/smarty/");
define('DIRECTORY_SEPARATOR', "/");
require(SMARTY_DIR."Smarty.class.php");
$smarty = new Smarty;[/php:1:c319a4d53f]
and it will work |
|
Back to top |
|
|