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

Directory setup question

 
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
subnet_rx
Smarty n00b


Joined: 11 Nov 2004
Posts: 3

PostPosted: Thu Nov 11, 2004 3:19 am    Post subject: Directory setup question Reply with quote

I'm confused about how to set smarty up in the directory structure. I want to install the template system for my script at www.mysite.com/script1/, so where should libs, templates, templates_c, cache, and config go?

I thought from the demo folder that these would just all go in the same directory. But the documentation suggests putting libs outside of the script directory.
_________________
ESiteNow Web Design
Back to top
View user's profile Send private message Visit poster's website
messju
Administrator


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

PostPosted: Thu Nov 11, 2004 7:25 am    Post subject: Reply with quote

if the directory on you server for http://www.mysite.com/script1/ is for example /home/users/mysite/htdocs/script1/ then "/home/users/mysite/htdocs" in called the document-root.

only put things that must be reachable by the browser below the webroot (= in subdirectories of htdocs): index.php, images, css etc.

put everything else in a directory above the webroot (in a directory parallel to htdocs): libs, templates, compiled templates, session-data, config.php etc.

for example:

accessible by the webbrowser:
/home/users/mysite/htdocs/script1/index.php <- the file you run to display the page

not accessible:
/home/users/mysite/templates/index.tpl
/home/users/mysite/phptmp/templates_c/ <- writable by the webserver
/home/users/mysite/phptmp/cache/ <- writable by the webserver
/home/users/mysite/lib/smarty/Smarty.class.php
/home/users/mysite/lib/smarty/plugins/ <- the plugins from the Smarty distribution
/home/users/mysite/plugins/ <- your own plugins
/home/users/mysite/lib/adodb/...

then instanciate your $smarty in a /home/users/mysite/config.php that also configures all paths like $smarty->template_dir, $smarty->compile_dir etc.

let all your pages below the document root include this config.php to get the $smarty instance.

(of course this is only one way. there are billion other ways, but i get along very good with something like the above)
Back to top
View user's profile Send private message Send e-mail Visit poster's website
subnet_rx
Smarty n00b


Joined: 11 Nov 2004
Posts: 3

PostPosted: Thu Nov 11, 2004 7:02 pm    Post subject: Reply with quote

so, what if I want to distribute this script? Every person has to upload it above their web root directory?
_________________
ESiteNow Web Design
Back to top
View user's profile Send private message Visit poster's website
messju
Administrator


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

PostPosted: Thu Nov 11, 2004 7:04 pm    Post subject: Reply with quote

no. of course you keep that configurable if you distribute it. it's is just a suggestion, not a must.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
subnet_rx
Smarty n00b


Joined: 11 Nov 2004
Posts: 3

PostPosted: Thu Nov 11, 2004 11:31 pm    Post subject: Reply with quote

ok, one last question. If I can set the permissions to 770 (locking everyone out from reading my files), then why can't I put all folders in the script directory? Is there added security in putting the files outside of the document root?
_________________
ESiteNow Web Design
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


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

PostPosted: Thu Nov 11, 2004 11:44 pm    Post subject: Reply with quote

subnet_rx wrote:
ok, one last question. If I can set the permissions to 770 (locking everyone out from reading my files), then why can't I put all folders in the script directory? Is there added security in putting the files outside of the document root?


The reasoning is that it is always safer to have "nonserved" files outside of the webroot than hidden within the webroot since a server compromise or admin error are far less likely to expose your private files. For security, the less you trust, the better. This is even more important for users who aren't well versed with server security.
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