PHPLights/Documentation/Quickstart
Application structure
The "app" directory in the phpLights package provides a good starting point for your new application. It contains the necessary directories and the entry point (index.php) with the bootstrapping code.
There are only a few files and directory which are absolutely necessary:
- index.php (start point)
- base.php (basic configuration)
- lib/ (for implemented classes controllers and models)
- template/ (for template files)
- template/base.php (basic view for output)
- template/error/internal.php (internal server error page)
- template/error/notfound.php (404 error page)
Optional files and directories are:
- config/ (configuration files)
- config/resource.php (available resources, e.g for databases)
- data/ (if needed)
- skin/ (css and image files)
- skin/default/css/debug.css (css for easy debugging)
- template/debug.php (view for easy debugging)
Calling the application
If the application is called without additional path information, defaults for controller and action are assumed. Therefore, the following URLs (assuming that "app" is the name of your application directory) are considered the same:
.../app .../app/index.php .../app/index.php/default .../app/index.php/default/index
The first parameter after "index.php" specifies the controller, the second the action. By default, the class "DefaultController" is used and its "index" member function is called.
The first character of the first parameter (controller) is upper-cased and the string "Controller" is appended. Internally, the framework does a lookup for a .php file of this name in the lib/ directory of the application which must include a class of the same name. Contrary to the controller parameter, the action parameter is used unmodified to find a corresponding method name.
To fill your application with life, first implement the "index" method in the "DefaultController" class and add further public methods for more actions. The next step may include creating more controller classes with some methods implemented for providing more functionality.
Back to Overview