Updated readme and fixed some whitespace issues

This commit is contained in:
Timothy Warren 2011-12-30 17:09:29 -05:00
parent a72f8d332f
commit 36f3ac3148
3 changed files with 172 additions and 94 deletions

View File

@ -1,3 +1,27 @@
miniMVC is a php framework based on javascript-like objects.
# miniMVC
miniMVC is a minimalistic Modular MVC framework, with built-in minifier, and pure-PHP templating system.
It has the following file structure
*index.php* - framework frontend
*app* - configuration and app-wide files
*config* - configuration files
*errors* - error page templates
*views* - global page templates
*assets* - frontend files
*js* - javascript files
*css* - css files
*config* - minifier configuration files
*modules* - MVC triads
*controllers* - controller classes
*models* - model classes
*views* - module-specific views
*sys* - core framework classes
It is currently pre-alpha. Features are still being built-out.

View File

@ -0,0 +1,6 @@
<?php
class Welcome_Model {
function __construct(){}
}

View File

@ -144,6 +144,8 @@ class miniMVC{
}
}
// --------------------------------------------------------------------------
class MM_Controller extends miniMVC {
function __construct()
@ -207,5 +209,51 @@ class MM_Controller extends miniMVC {
}
}
/**
* Function for loading a model into the current controller
*
* @param string $file
*/
function load_model($file)
{
$path = "";
// The module is the lower of the class name
// need to figure out a way to allow multiple controllers
// in one module
$module = strtolower(get_class($this));
$not_modules = array('miniMVC', 'page', 'db', 'output');
// If it's a module, look in the module view folder
if( ! in_array($module, $not_modules))
{
$path = MOD_PATH . "{$module}/models/{$file}.php";
}
require_once($path);
$this->$file = new $file;
}
}
// --------------------------------------------------------------------------
class MM_Model extends miniMVC {
function __construct()
{
parent::__construct();
}
/**
* Adds the database class to the current model class
*/
function load_db($name)
{
$this->db = new db($name);
}
}
// End of miniMVC.php