Table of Contents
Through the Knowledge Management Tool, information is not only published to [ http://help.unc.edu ] help.unc.edu , but can also be published to external web sites. By using external publishing, KMT users have the ability to display their documents almost anywhere on UNC webspace, while maintaining the content with a single tool. For an example of how this functions, see below:
-
[ http://help.unc.edu/?id=6172 ] Knowledge Management Tool: User Manual (KMT Item 6172)
-
[ http://its.unc.edu/comm/dev/scripts/kbitem.php?id=6172 ] The same through external publishing (KMT Item 6172)
These examples demonstrate the ability to provide the same information to customers through multiple pages.
These directions are for UNC web servers You may use PHP to include one document in a particular page with other text, or create a template on your site that dynamically includes any number of documents based on the parameters passed to the page.
Note
Previously, we used a perl script located in www.unc.edu/sr-bin/ which allowed users to publish documents using the apache shtml include directive. This method is depricated for several reasons and below details the new method.
The first external publishing option makes use of a "dynamic include", where the ID number of the HelpSite document is part of the URL. This has the advantage of being flexible, allowing you to use the same page to display multiple documents. Follow the steps below to create a dynamic include.
Note
For the purposes of this example, we are using HelpSite document number 1316 as a "safety document" which in a dynamic include is a good practice. This would be the document you want to appear if no parameter was passed.
-
create a file called "yourpage.php"
-
In the content area of the page, wherever you want the item to appear, insert the following line of code:
<?php require '/afs/isis.unc.edu/depts/its/public_html/comm/dev/scripts/kbitem-request.php'; /** Get the id off the request safely in a dynamic fashion. 1316 is the default * item, substitute for any item number you wish. **/ $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : 1316; $doc = new KBItem($id); echo $doc->DownloadToString(); ?>This should pull the contents of whichever document is identified by the URL and include it when the page is displayed to the user.
-
create links to your new page with this URL:
yourpage.php?id=4477
To see this in action with an actual page, view the following URL. Feel free to substitute other document numbers in the URL to see different content displayed on the page.
Alternately, you can statically include the documents (or multiple documents) in your page by explicitly listing the document numbers in the code. This has the advantage of obscuring the fact that the document is being pulled from the KMT. Follow the steps below to create a static include.
-
create a page called yourpage.php;
-
Include the following line somewhere near the top of the page:
<?php require '/afs/isis.unc.edu/depts/its/public_html/comm/dev/scripts/kbitem-request.php'; ?>
This ensures that the required php class is available to the script.
-
Next, create your list of HelpSite documents that you want to display on this page using the construction $doc=new KBItem(MYDOCNUMBER); (See below)
<?php $doc_1= new KBItem(873); $doc_2= new KBItem(4477); $doc_3 = new KBItem(1316); ?>Note
You may list out one or more documents, in this example we are using three documents: 1316, 4477, and 873. These documents were selected at random.
-
In your page, wherever you want a KMT/help item to appear
(If I wanted to present the documents in order) <?php echo $doc_1->DownloadToString(); echo $doc_2->DownloadToString(); echo $doc_3->DownloadToString(); ?>
To see a working example of this static implementation, go to:


