PHPLights/Documentation/Quickstart

From Linuxnetworks
< PHPLights‎ | Documentation
Revision as of 14:44, 23 October 2007 by Nose (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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 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 controller parameter is upper-cased and "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 look for a corresponding method name.



Back to Overview