So lets start with the folder structure. The way you structure your application is crucial. Here is what i have come up with. This structure is only suggestive, you are free to modify it to suit your taste.
- Classes: Store all your classes and helper code here.
- Conf: This holds your configuration files needed for your application.
- Cron: Holds all files which needs to run as cron job.
- Includes: Store all your function files here.
- Js: Javascript code plus any helper code like WYSIWYG editor etc.
- Locale: Create folders for every language you plan to support and create language files which you can call depending upon the configuration settings.
- Pages: All the pages which perform some directly visible action are stored here. Rest can be stored in the helper sub-directory.
- Setup: Some scripts which can generate configuration files plus some SQL files needed for your application.
- Style: All CSS + Images, can be organised using themes folder.
- Templates: Divided in two sections. Forms stores all the form templates and layout stores what else layout templates.
- Tmp: Store temporary files or stuff which is not private. You can use this folder to store cached files in your site as well.
http://yoursite.com/app/index.php?action=login
The index page catches the "action" parameter and loads the login.php file and depending upon the current state plus extra variables performs some action.
Lets get an overview of the index.php file
require_once( DIRNAME(__FILE__) .'/includes/app_init.php');This line invokes the file which does all the initiation stuff, like loading the configuration file, loading the framework, loading the default template, defining some variables etc.