Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Very wierd...Change name of template everthing fails....

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Rizza
Smarty n00b


Joined: 21 Nov 2003
Posts: 2

PostPosted: Fri Nov 21, 2003 5:42 am    Post subject: Very wierd...Change name of template everthing fails.... Reply with quote

Real Quick...

I have this php page

include($_SERVER['DOCUMENT_ROOT']."/includes/Smarty.class.php");
$smarty = new Smarty;
$smarty->template_dir = '/path/to/mydir/templates';
$smarty->compile_dir = '/path/to/mydir/templates_c';
$smarty->config_dir = 'path/to/my/configs';
$smarty->cache_dir = '/path/to/my/cache';
$smarty->display('home.tpl');


then i have this home.tpl
{include file="header.tpl"}
this is home
{include file="footer.tpl"}

Page shows just fine there's my header..content section with the words this is home, and my footer. Works great in any dir of my project.

But if change the last line of my php script(change the template) to read
$smarty->display('helpme.tpl');

where help.tpl is
{include file="header.tpl"}
this is helpme
{include file="footer.tpl"}

i get the dreaded
Warning: Smarty error: problem creating directory "/path/to/my/templates_c/%%-10/%%-1040964229" in /server/document/root/path/includes/Smarty.class.php on line 1042

Warning: Smarty error: problem writing temporary file '/path/to/my/templates_c/%%-10/%%-1040964229/3fbda3b56b73c' in /server/document/root/path/includes/Smarty.class.php on line 1042

I'm at lost, so i check and my php page loads the header if use
$smarty->display('header.tpl');

I'm at a total lost now as what to do...i'm a solid developer who is just clueless at this point...I looked at filenames, extensions, everthing. I 've even copied the home.tpl to home2.tpl and tried that...no luck.

anybody help....


Thanks in advance
Back to top
View user's profile Send private message
Enquest
Smarty Regular


Joined: 14 May 2003
Posts: 79

PostPosted: Fri Nov 21, 2003 9:56 am    Post subject: Reply with quote

When it happens to me I'm also clueless. However empty your templates_c dir and check if you have the permissions to overwrith and set it to chmod 777

It could do the trick!
_________________
-----------------------
Learning my self by trying to help others
Back to top
View user's profile Send private message
Rizza
Smarty n00b


Joined: 21 Nov 2003
Posts: 2

PostPosted: Fri Nov 21, 2003 1:38 pm    Post subject: Yeah but chmod 777 isnt that not good practice Reply with quote

I'll try that but if the problem lies in permssions i think that changing to 777 isnt the greatest fix unless, i move these documents outside the webroot. I can try that and see if it works, i'll be sure to let you know.

It seems to me that Smarty has a boat load of little quirks they really need to figure out.

I think that they could try and handle common errors a little bit better in the program, but thats just my $.02

Either way, when it works its the best thing since sliced bread, passing db results directly to the template and then figuring out to display them in the template is quick and dirty, but it's great.

Enough from me.. i'll let you know
Back to top
View user's profile Send private message
Enquest
Smarty Regular


Joined: 14 May 2003
Posts: 79

PostPosted: Fri Nov 21, 2003 1:52 pm    Post subject: Reply with quote

Actualy I think Smarty has almost no quircks and works excelent. Provided you have a little patience in the beginnen.
If you on a GNU/Linux box (wich you should) then you can chown -R user.user templates_c

Because its sometimes a permission, owner problem!
_________________
-----------------------
Learning my self by trying to help others
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri Nov 21, 2003 6:23 pm    Post subject: Reply with quote

I certainly feel empathy for Rizza's position. Rizza, do you have specific suggestions that you think would improve the process?

On the other hand, I think Enquest is also right--like any tool, once you get to understand how to use it, (most of) the obstacles you had while learning seem to melt away.
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Fri Nov 21, 2003 6:41 pm    Post subject: Reply with quote

it's really simple. learn how to write files to the server with php. learn how the permissions-system of the operating system you use works and what precautions have to be taken that the process running the php-programm can write to certain directories. i don't think it's a smarty issue. i think it's php-basics. once you figured out how to do that it's a piece of cake to configure smarty.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
GoRaiders007
Smarty n00b


Joined: 04 Dec 2003
Posts: 2

PostPosted: Thu Dec 04, 2003 11:38 pm    Post subject: Reply with quote

Rizza,
Any luck with your problem. I've been experiencing the same thing and although i"ve searched the forum, faqs, etc. No one has found the answer. usinging chmod 777 doesn't work for me. I only have luck if I run apache as the same user as mydir/templates_c.

I've read discussions about using 'use_sub_dirs = false' and that doesn't help in either mode. Just curious if anyone has a definate answer.

thanks
Back to top
View user's profile Send private message
Enquest
Smarty Regular


Joined: 14 May 2003
Posts: 79

PostPosted: Fri Dec 05, 2003 8:53 am    Post subject: Reply with quote

Do you use GNU/Linux?

If so check owner ship. ls -l
_________________
-----------------------
Learning my self by trying to help others
Back to top
View user's profile Send private message
GoRaiders007
Smarty n00b


Joined: 04 Dec 2003
Posts: 2

PostPosted: Fri Dec 05, 2003 4:25 pm    Post subject: Reply with quote

I'm on Sun Sparc station running Solaris. As far as I know, chmod works the same and the permissions are wide open on the smarty dirs (777). The user/group of these dirs are <myuserid>/<mygroupid>.

Changing the use_sub_dirs flag only changes the error message (can't create dir vs can't write file). I tired to remove all files in the .../templates_c (and other smarty dirs) but that has no effect. The only solution I found is to run apache as <myuserid>. Not always possible on my test box. In our production box, the userid is the same for apache and smarty/dirs/ so its not the end of the world.

thanks
Back to top
View user's profile Send private message
Enquest
Smarty Regular


Joined: 14 May 2003
Posts: 79

PostPosted: Fri Dec 05, 2003 9:10 pm    Post subject: Reply with quote

I don't now Sun but it seems a user permission problem. You should check the users status of templates_c and check if the user has permission!

Onno
_________________
-----------------------
Learning my self by trying to help others
Back to top
View user's profile Send private message
Enquest
Smarty Regular


Joined: 14 May 2003
Posts: 79

PostPosted: Fri Dec 05, 2003 9:11 pm    Post subject: Reply with quote

I don't now Sun but it seems a user permission problem. You should check the users status of templates_c and check if the user has permission!

Onno
_________________
-----------------------
Learning my self by trying to help others
Back to top
View user's profile Send private message
Enquest
Smarty Regular


Joined: 14 May 2003
Posts: 79

PostPosted: Fri Dec 05, 2003 9:13 pm    Post subject: Reply with quote

I don't now Sun but it seems a user permission problem. You should check the users status of templates_c and check if the user has permission!

Onno
_________________
-----------------------
Learning my self by trying to help others
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri Dec 05, 2003 9:34 pm    Post subject: Reply with quote

read this:

http://www.phpinsider.com/smarty-forum/viewtopic.php?t=1519
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP