BwFramework
- a lightweight MVC framework for PHP
Class: BwFramework
constructor BwFramework ()
A no-arg constructor.
void dispatch ()
Runs the controller specified by URL path, and outputs it content to the client.
void setCharset ([string content-type [, string charset]])
Sets headers for content-type and charset for the response to client. Default is 'text/html' as content-type and 'utf-8' as charset.
void init ()
Read the URL and match it to a controller and action, plus feed the file provider if the requested file is a CSS or JavaScript asset.
void setURIRewrites (array rewrites)
Set up rewrites for full paths, as explained in the example section.
Class: Controller
void assign (string key, mixed value);
Assigns a Smarty variable a value, identical to Smarty::assign (string varname, mixed var).
string getParam(int index)
Returns a URL variable at position 'index', where the request parameters are treated as an array (apart from controller name and action name).
http://www.domain.com/controller/action/param_index_0/param_index_1/.../param_index_n
void redirect ([string controller [, string action [, array params]]])
Forces a redirect to the specified controller/action/param_1/.../param_n. If called with a no-arg call, the redirect will go to http://www.domain.com/ calling the IndexController and indexAction(). A call to redirect ('videos', 'play', array ('my_cat_kisses_my_dog')) will be redirected to http://www.domain.com/videos/play/my_cat_kisses_my_dog.