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

MacOSX : unable to read resource: index.tpl

 
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 -> Installation and Setup
View previous topic :: View next topic  
Author Message
mgm_03
Smarty Rookie


Joined: 07 Dec 2004
Posts: 23

PostPosted: Tue Dec 07, 2004 10:01 pm    Post subject: MacOSX : unable to read resource: index.tpl Reply with quote

Hopefully the administrators' patience has not run dry...I've heard great things about Smarty and want to use it on my next client project. I'm not a php noobie but not a guru either. Using Mac OS X / php4.34 / apache 1.3.

The Smarty directory is located in the include_path which is .:/usr/local/php/lib/php. Document root is : /Library/WebServer/Documents

Code:

require('Smarty/Smarty.class.php');
$smarty = new Smarty;   // running this generates no errors.


$smarty ->template_dir = '/Library/WebServer/Documents/Majestic/smarty/majestic/templates/';
$smarty->compile_dir = '/Library/WebServer/Documents/Majestic/smarty/majestic/templates_c/';
$smarty->config_dir = '/Library/WebServer/Documents/Majestic/smarty/majestic/configs/';
$smarty->compile_dir = '/Library/WebServer/Documents/Majestic/smarty/majestic/cache/';

$smarty-> assign('name', 'Mark');
$smarty->display('index.tpl');


Questions:
Am I correctly identifying the absolute paths?
Majestic is a website I am developing on my notebook. 'smarty' contains the 4 directories.

I can't seem to set the user to 'www' for those 4 folders. That user is not available to me when I try to change to a different user.

www:*:70:70::0:0:World Wide Web Server:/Library/WebServer:/dev/null

drwxr-xr-x 8 markmara admin 272 Dec 7 15:04 .
drwxr-xr-x 3 markmara admin 102 Dec 7 13:36 ..
drwxr-xr-x 2 nobody nobody 68 Dec 7 13:42 cache
drwxr-xr-x 2 nobody nobody 68 Dec 7 13:42 config
drwxr-xr-x 2 nobody nobody 68 Dec 7 13:42 templates
drwxr-xr-x 2 nobody nobody 68 Dec 7 13:41 templates_c

Any tips/advice are greatly appreciated.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Tue Dec 07, 2004 11:10 pm    Post subject: Reply with quote

I have an OS X box here, I can change ownership of files to www:

chmod www [filename]

What do you get when you id the user? Here is what I see:

[root@foo mohrt]# id www
uid=70(www) gid=70(www) groups=70(www)
Back to top
View user's profile Send private message Visit poster's website
mgm_03
Smarty Rookie


Joined: 07 Dec 2004
Posts: 23

PostPosted: Tue Dec 07, 2004 11:29 pm    Post subject: Reply with quote

Thanks for the prompt reply.

I have the same info for id www

I was able to chown the 4 directories to www:www (user:group). I had to log in as root...apparently, only root can change ownership. Prior to that I was trying do it through Aqua.

drwxr-xr-x 2 www www 68 Dec 7 13:42 cache
drwxr-xr-x 2 www www 68 Dec 7 13:42 config
drwxr-xr-x 2 www www 68 Dec 7 13:42 templates
drwxr-xr-x 2 www www 68 Dec 7 13:41 templates_c

But...still getting :

Warning: Smarty error: unable to read resource: "index.tpl" in /usr/local/php/lib/php/Smarty/Smarty.class.php on line 1084 ok

I feel like an idiot.
Back to top
View user's profile Send private message
mgm_03
Smarty Rookie


Joined: 07 Dec 2004
Posts: 23

PostPosted: Wed Dec 08, 2004 12:21 am    Post subject: Reply with quote

In an effort to solve this problem, I've been going back and forth to the documentation and noticed a peculiar comment :

Quote:
We need to create the index.tpl file that Smarty will load. This will be located in your $template_dir.


After that the doc refers to index.php.

Is this a typo?

Do I need to create an index.tpl file or index.php? And, what goes in it?
Back to top
View user's profile Send private message
mgm_03
Smarty Rookie


Joined: 07 Dec 2004
Posts: 23

PostPosted: Wed Dec 08, 2004 12:27 am    Post subject: Reply with quote

OK...It's official now: I AM A GENUINE IDIOT.

I did not have an index.tpl file in the templates directory.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Wed Dec 08, 2004 2:43 am    Post subject: Reply with quote

mgm_03 wrote:
I was able to chown the 4 directories to www:www (user:group). I had to log in as root...apparently, only root can change ownership. Prior to that I was trying do it through Aqua.


lol, I've had my head buried in the unix sand for so many years that it didn't even occur to me that you might be trying this as someone other than root. Yes, only the root user (or user with root privs) can change the ownership of a file, which makes perfect sense if you think about it Smile
Back to top
View user's profile Send private message Visit poster's website
mgm_03
Smarty Rookie


Joined: 07 Dec 2004
Posts: 23

PostPosted: Wed Dec 08, 2004 3:44 am    Post subject: Reply with quote

I envy you...unix just isn't something I'm involved with on a regular basis...so, it's always a mystery. I know it's better to work from the command line but with all the web stuff I need to learn, getting in a shell isn't high on the priority list.

Something that I don't understand...from the doc:

Quote:
Be sure you know the location of your web server document root. In our example, the document root is "/web/www.mydomain.com/docs/". The Smarty directories are only accessed by the Smarty library and never accessed directly by the web browser. Therefore to avoid any security concerns, it is recommended to place these directories outside of the document root.


Based on my current configuration, my folders are 'in' the document root...but doing that is discouraged, right?

Suggestion: I may or may not be the only person who didn't catch on to the fact that I needed to create an empty index.tpl file, but it wouldn't hurt to make that super-clear in the documentation.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Wed Dec 08, 2004 4:40 am    Post subject: Reply with quote

yes, the smarty directories should be outside of the document root if possible.

As for the documentation:

Quote:
We need to create the index.tpl file that Smarty will load. This will be located in your $template_dir.


Then it goes on to edit the file and show its contents. Not clear enough?
Back to top
View user's profile Send private message Visit poster's website
mgm_03
Smarty Rookie


Joined: 07 Dec 2004
Posts: 23

PostPosted: Wed Dec 08, 2004 5:05 am    Post subject: Reply with quote

you're right...it's clear...remember that part about being an idiot?
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 -> Installation and Setup 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