Updated readme and fixed some whitespace issues
This commit is contained in:
parent
a72f8d332f
commit
36f3ac3148
28
README.md
28
README.md
@ -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.
|
|
6
modules/welcome/models/welcome_model.php
Normal file
6
modules/welcome/models/welcome_model.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Welcome_Model {
|
||||||
|
|
||||||
|
function __construct(){}
|
||||||
|
}
|
@ -144,6 +144,8 @@ class miniMVC{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
class MM_Controller extends miniMVC {
|
class MM_Controller extends miniMVC {
|
||||||
|
|
||||||
function __construct()
|
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
|
// End of miniMVC.php
|
Loading…
Reference in New Issue
Block a user