Developing portlets
From KnowledgeTree Document Management Made Simple
Portlets are a way for information and potential actions to be displayed for various pages in KnowledgeTree. These usually appear on the left-hand side of the page.
The "Document Actions", "Folder Actions", and "Search" items on the left-hand side of the page are portlets.
Portlets generally extend the KTPortlet class:
require_once(KT_LIB_DIR . '/widgets/portlet.inc.php');
class KTSearchPortlet extends KTPortlet {
...
}
Portlets need only implement the render method:
function render() {
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate("kt3/portlets/search_portlet");
$aTemplateData = array(
"context" => $this,
);
return $oTemplate->render($aTemplateData);
}
Portlets should be registered to a plugin:
$oPlugin->registerPortlet(array('browse', 'dashboard'), 'KTSearchPortlet', 'ktcore.portlets.search', 'portlets/KTPortlets.php');
- The first parameter is a string or an array of strings describing which pages the portlets display on.
- The second parameter is the name of the class.
- The third parameter is a unique namespaced name for the portlet.
- The fourth (optional) parameter is the file that contains the implementation of the class.
Most portlets set their name in their contructor:
class MyPortlet extends KTPortlet {
function NextIDPortlet() {
parent::KTPortlet('My Portlet');
}
...
}
del.icio.us
reddit

