Sado View Object Documentation
The Sado View object is used to create HTML table "views" to display a single database record.Creating and using a view is simple:
// include bootstrap
require_once './lib/Sado/sado.bootstrap.php';
// create ORM class
class User extends SadoORM
{
// nothing here
}
// create View class
class UserView extends SadoView
{
// initialize view, pass user_id param
public function __construct($user_id)
{
// set model, load user with user ID
$this->model(new User($user_id));
// add view labels and fields
$this->cellLabel('Name:');
$this->cellField('fullname');
// start a new row
$this->cellLabel('Email Address:');
$this->cellField('email');
}
}
// set View object
$view = new UserView(5); // load user with user ID 5
// display view
echo $view->getView();
