Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
smarty folder structure

 
Post new topic   Reply to topic    Smarty Forum Index -> Installation and Setup
View previous topic :: View next topic  
Author Message
russia5
Smarty Rookie


Joined: 24 Dec 2005
Posts: 12
Location: Pasadena Ca

PostPosted: Fri May 25, 2007 4:18 pm    Post subject: smarty folder structure Reply with quote

I have done quite a bit of searching for the folder structure for my new Smarty Framework. I want to set it up right, so I don't get a whole bunch of programming done, and find out that there is a different way I should have done it for security purposes and, for a lesser reason, application purposes. I have seen several different ways to structure Smarty Frameworks. Is there any significant advantages of setting up the directories one way or another. Can I set up my site with the standard "out of the box" Smarty format?

public_html/


--connections
--configs/
--cache/
--templates/
--templates_c/
--libs/
index.php

I have found a way to protect the templates with HTACCESS If I set it up this way, should there be a problem? Can virus search on templates/ or templates_c/ to find Smarty Sites to hack? Should I put my plugins that I create in the /libs/plugins or create another directory --plugins/ I believe it has been done both ways, is there an advantage? Also, Functions that I produce to create my plugins, can I put them into the libs/internals? I think it has been suggested to create another folder, possibly --includes/ and put them there.

I also want to create large applications ie) galleries, memberships, mailers, shopping carts, my backend, etc. Is it smart to create a folder of php or each appl and include it into the index.php under the doc root,( or other php pages under the doc root), then pull them through templates to get the apps implanted into pages one click away from the home page or on the home page.
_________________
Success to all!
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
Dasher
Smarty Pro


Joined: 16 May 2007
Posts: 124
Location: Italy

PostPosted: Fri May 25, 2007 6:14 pm    Post subject: Reply with quote

A good place to start is:
http://www.phpinsider.com/smarty-forum/viewtopic.php?t=7310

Best practice is to keep the files, where possible, outside the public folder. .htaccess works - but a mis-configuration or don't escape your input strings and you leave yourself open.

If it needs to be directly served up to the user - such as an image, css, etc then it should live under the public folder. Otherwise keep higher up and out of direct access.
_________________
General Blog: http://dasher.wordpress.com
VoIP & SIP: http://blog.sipx.ws
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
russia5
Smarty Rookie


Joined: 24 Dec 2005
Posts: 12
Location: Pasadena Ca

PostPosted: Sat May 26, 2007 10:14 am    Post subject: Reply with quote

Thanks for that link to file structure. It was very helpful! Correct me if I am wrong, but in your suggested posting, it looks like the guy is creating an application in a folder www.mysite.com/html/

I want my surfers to log into my Smarty home page of www.mysite.com I do not see any other way but to set up the files as I have suggested above and I do not see any examples anywhere that can create Smarty folders outside the webroot, but still have the home page Smarty. Am I correct?
_________________
Success to all!
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
Dasher
Smarty Pro


Joined: 16 May 2007
Posts: 124
Location: Italy

PostPosted: Sat May 26, 2007 10:22 am    Post subject: Reply with quote

The folder structure of many webhosts have the actual HTML folder under the domain name - but this is never seen by the users - who would reach the site via: http://www.theHost.com - the actual folder that the pages are served is via a vhosts (with Apache) section which points to /www.theHost.com/html.

It's done this way because often you need to store information that shouldn't be acessible to end users somewhere (such as config information which may contain username & passwords).

By setting the config variables of Smarty - example 2-9 from http://smarty.php.net/manual/en/installing.smarty.basic.php - you can have the smarty engine, templates, config, etc outside of the public pages.
_________________
General Blog: http://dasher.wordpress.com
VoIP & SIP: http://blog.sipx.ws
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
toplisek
Smarty Rookie


Joined: 17 Sep 2009
Posts: 33

PostPosted: Tue Dec 11, 2012 8:41 am    Post subject: Reply with quote

Is there some good structure/php script to connect to WP?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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