web2bb is original work by Kevin Waterson distributed under the new BSD license from this website: http://chopwoodfetchwater.com/
WEB2BB is an ultra light, ultra fast, and freely available MVC written in PHP. It does not try to be all things to all people, nor does it even care what other frameworks do. It just provides a simple and easy to use framework for PHP projects.
Original framework requires PHP 5.3 and uses namespaces.
My version is ported to work in PHP 5.2.x and enhanced in several ways:
- render() method in baseController
- redirect() method in baseController
- db_encoding config parameter was added for section database. For MySQL only.
- simplified view variables setup:
For *all* template variables ()
$this->view->variable = 'text';
$this->render('edit');
...
then in template edit.phtml or layout:
...
<?php echo $variable; ?>... $this->layout=null; // or $this->layout='site'; $this->cache = true; // cache this action, false by default ... $this->render(); // default 'index'
class someController extends baseController {
function view($id,$action) {
// controller action
}
}
...
url for this action:
/some/view/1/move/
and action view(1,'move') will be called. /some/view/ without parameters will generate an error.- added dbAbstraction class methods: field(get field value), inc(increment field by value) and hasField(if table has specified field) methods.
- application models in /models/app/. They are extending dbAbstraction class and initializing in controller constructors like this:
class blogController extends baseController implements IController
{
public function __construct()
{
parent::__construct();
$this->blog = new blogModel; // model
$this->module = 'blog'; // set current module for render method to search for template path
$this->view->title = 'My blog';
}See /models/app/blogmodel.php for example model. Example controller is /modules/blog/controllers/blogcontroller. Views are in /modules/blog/views/.
All is quite simple, you can learn the code of the whole framework in one hour. And it's still super fast, even with my enhancements ;-)
Sergei Yatsenko, http://yatsenko.ru