<?php
// Nooku Framework 0.7 Example// See http://nooku.org/framework/*CREATE TABLE IF NOT EXISTS `#__harbour_boats` ( `harbour_boat_id` SERIAL, `name` varchar(255) NOT NULL, `enabled` tinyint(1) NOT NULL default '1', `description` text NULL) ENGINE=MyISAM DEFAULT CHARSET=utf8;*/// Get the model from the factory. No need to write the model class, // if it doesn't exist, the factory will create an intelligent model for you,// and link it up to the right db table$model=KFactory::get('admin::com.harbour.model.boats');
// Get a list of boats records including all their fields// Use the fluent interface to manipulate the result set, without writing any queries$boats=$model->order('name')->limit(10)->offset(20)->enabled(1)->getList();
foreach($boatsas$boat)
{
echo$boat->name.': '.$boat->description.'<br />';
}
// NOTE This code is complete! It will work out of the box. Just install Nooku Framework, // add the db table, put the code somewhere and it will work.