External Publishing


 What is External Publishing?

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:

These examples demonstrate the ability to provide the same information to customers through multiple pages.

 How do I use External Publishing?

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.

 Option One - Dynamic Include

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.

  1. create a file called "yourpage.php"

  2. 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.

  3. 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.

 Option Two - Static Include

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.

  1. create a page called yourpage.php;

  2. 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.

  3. 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.

  4. 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:

Copyright 2002-2007 The University of North Carolina at Chapel Hill.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 United States License.

Post a Comment

This form is for document feedback. If you need technical assistance, and are affiliated with UNC-Chapel Hill, please Submit a Help Request
Optional
Optional
So that we may contact you.
Do not fill out this form, this is a spam trap.
Top
University of North Carolina - Chapel Hill