Friday, May 04, 2007

Creating and linking a fresh php page in KnowledgeTree DMS (KTDMS Series 1)

Creating a new php page and linking it on the main page (alongside the dashboard, browse and dms administration hyperlinks) involves several steps described below:




- Create a fresh new php page and make sure you include the following essential includes:

require_once 'config/dmsDefaults.php';
require_once KT_LIB_DIR . '/templating/templating.inc.php';
require_once KT_LIB_DIR . '/templating/kt3template.inc.php';
require_once KT_LIB_DIR . '/dispatcher.inc.php';
require_once KT_LIB_DIR . '/util/ktutil.php';

Let's say the new php page you created is "mytrainingrecords.php" and you want to link the action "mytrainingrecords" to this page. Go into the kt3template.inc.php file and scroll across until you come across the "initMenu" function. Populate the $this->menu array to include the following array item:
"mytrainingrecords" => $this->_actionHelper(array("name"=>_kt("My Training Records"), "action"=>"mytrainingrecords", "active"=>0))

That adds up the additional link on the main horizontal menubar alongside the dashboard and browse links. When somebody clicks on this link, the KTDMS will use the controller page (control.php) to figure out what page to call and it does that by following the mapping defined in the siteMap.php (located in the config directory). Open up the siteMap.php page and add the following php line anywhere:

$default->siteMap->addPage("mytrainingrecords", "/mytrainingrecords.php", "My Training Records", Guest, "mytrainingrecords");


That is pretty much it.

No comments:

About Me

My photo
Princeton, New Jersey, United States
I am an Information Technology Analyst with extensive background in the Clinical Industry that includes working for CROs, Pharmaceutical and Medical Diagnostic companies.