Application - amadeus-web-archives/MicroVC GitHub Wiki

The application (in its simplest form) needs to have only a config, actions(controller), view and a template(header and footer).

In its root (site root) folder, only 2 files are needed, viz.

.htaccess

Contains the rules to rewrite everything to index.php, except few items like the _ (wwwroot), uploads, favicon.ico etc.

index.php

Just needs to call include_once '../inc/bootstrap.php'; The framework can be in any folder and a single install can be shared by multiple applications (thanks to YII for the idea).

After that, a few simple lines of code are needed

var controller = getController(); // Calls bootstrap.php method to run controller method
extract(controller->data); // extract the data array as variables

if (!controller.ajax) include settings["templatefol"] + "header.php";
include_once controller.view; // include the view file
var time = timer_end(); // add a variable that can be used in the footer.
if (!controller.ajax) include settings["templatefol"] . "footer.php";

What follows are files inside the app folder.

Actions

app/actions.php This is the controller file that has one method per action. default action is "home". For more information, see inc/controller.php for details on what can be used.

Config

app/config.php

DB Connection Details

You can call config_db($host, $uname, $pwd, $dbname, $environment) where $environment is optional and must correspond with the optional $db['environment'] for the config to be used up.

singlemodule

Set this if you dont want to use underscores for controller method names. This is done when your app is so small it doesnt need multiple controllers.

Site Info

Set the name, copyright and default title here.

you may also include any other settings for your application.

Template

A header.php and footer.php should be in app\templates[templatename]
default templatename is "default"

The template is of course not used if $controller->ajax == 1

View(s)

These must be in the app/views folder. Unless modified by Controller->set_view, the name is the same as the action. The Default is home.php.


WWW Root

A name from my cakephp days, this refers to the _ folder of the site root. It contains css, js and images (usually in sub folders) It is excluded from url rewriting by default. If you choose not to use it, you will miss the feature of root_url() which includes the timestamp (intended for css and js files).