<?php
/**
* New service
* @package CHANGE
*/
class Cgn_Service_CHANGE_ME extends Cgn_Service {
function __construct() { }
function mainEvent(&$req, &$t) {
$t['message'] = "This is the main event.";
}
}
Skeletal Trusted Service (Spam filter)
<?php
/**
* New service
* @package CHANGE
*/
class Cgn_Service_CHANGE_ME extends Cgn_Service_Trusted {
var $untrustLimit = 3;
var $entry = NULL;
var $usesConfig = TRUE;
var $dieOnFailure = TRUE;
function __construct() {
$this->screenPosts();
$this->trustPlugin('throttle',10);
$this->trustPlugin('html',10);
// $this->trustPlugin('requireCookie');
// $this->trustPlugin('secureForm');
}
function mainEvent(&$req, &$t) {
$t['message'] = "This is the main event.";
}
}
Cgn_Template::setSiteTagLine("put all your fancy quotes here.");
Ini Settings
Create a new section callback (layout.ini)
;use boot/local/layout.ini for local changes
[object]
column.leftside=@lib.path@/lib_cgn_layout.php:Cgn_LayoutManager:defaultLayoutManager:showMainContent
Create a new database connection (core.ini)
;use boot/local/core.ini for local changes
[dsn]
custom.uri=mysql://user:password@localhost/cognifty
MVC
Create a new MVC Table (array records)
include_once(CGN_LIB_PATH.'/html_widgets/lib_cgn_widget.php');
include_once(CGN_LIB_PATH.'/lib_cgn_mvc.php');
include_once(CGN_LIB_PATH.'/lib_cgn_mvc_table.php');
$list = new Cgn_Mvc_TableModel();
//cut up the data into table data
foreach ($recordList as $record) {
$list->data[] = array(
cgn_applink(
$record['title'],
'module','service','event',array('id'=>$record['table_id'])),
$record['caption'],
$record['sub_type'],
cgn_applink('edit','module','service','edit',array('id'=>$record['table_id'])),
cgn_applink('delete','module','service','del',array('table_id'=>$record['table_id'],'table'=>'table')),
);
}
$list->headers = array('Title','Sub-Title','Version','Sub-Type','Edit','Delete');
$t['table'] = new Cgn_Mvc_TableView($list);
Create a new MVC Table (data items)
include_once(CGN_LIB_PATH.'/html_widgets/lib_cgn_widget.php');
include_once(CGN_LIB_PATH.'/lib_cgn_mvc.php');
include_once(CGN_LIB_PATH.'/lib_cgn_mvc_table.php');
$list = new Cgn_Mvc_TableModel();
//cut up the data into table data
foreach ($objectList as $object) {
$list->data[] = array(
cgn_applink(
$object->title,
'module','service','event',array('id'=>$object->getPrimaryKey())),
$object->caption,
$object->sub_type,
cgn_applink('edit','module','service','edit',array('id'=>$object->getPrimaryKey())),
cgn_applink('delete','module','service','del',array('table_id'=>$object->table_id,'table'=>$object->_table)),
);
}
$list->headers = array('Title','Caption','Version','Sub-Type','Edit','Delete');
$t['table'] = new Cgn_Mvc_TableView($list);