Encounter CSS API for PHP


The Encounter CSS PHP API provides programmatic access to three items:

  1. A section’s list of pages
  2. A page’s content and meta-data such as title, keywords, and description
  3. Links to multi-lingual content, if you subscribe to it

A request to the API consists of three parts:

  1. API Key: An alpha-numeric string provided to you by Practis, Inc.; this is used to authenticate your access to Encounter.
  2. Section ID: A numeric identifier for the section you wish to access; this is used to lookup the navigation items of the section you are accessing.
  3. URI Offset: A numeric offset of the directory in the URL, e.g. a URI of example.com/parent/child/ with an offset of 2 would refer to the string ‘child’ and, in combination with the section identifier, is used to lookup the page named ‘child’ within the given section. The URI offset defaults to 2 if none is provided.

Server Requirements

  • Apache with Module mod_rewrite
  • PHP 5+ with cURL (Client URL Library)

The Famous 5 Minute Install


  • Upload the folder labeled “encounter” in the root of your website.
  • Visit the example folder in your web browser: http://www.example.com/encounter
    You should see a page of text content followed by an unordered list of links to other pages.
  • Click one of the navigation links. The page should refresh and display the selected content.

Renaming / Moving the Encounter Folder

If you would like to rename the name of the “encounter” folder to something else, you must also change the following items.

  1. .htaccess – Update the RewriteBase with the corresponding folder name
  2. index.php – Update the $path argument of the subnav() function with the corresponding folder name

If you move the encounter folder outside of the root directory of the website, you will also need to update the URI Offset argument in the content.inc.php file.

Styling the Encounter Page

After you have completed the steps above you can begin to restyle the Encounter content page. The index.php page will be used to display all of the pages in your content library. Simply replace the example html markup with the markup of your website. Make sure that you do not delete any of the PHP code necessary for displaying content, navigation, or meta data.

Suggestions for Better SEO

  • Keep the Encounter folder as close to the website root as possible.
  • Rename the Encounter folder using the name of the product or service you are trying to market.
  • Make sure the the Encounter folder is indexable by search engines. Remove any “noindex” meta or “canonical” link tags from the page.
  • Add links to the Encounter content throughout your website. Main navigation, sub-navigation, product / service pages, and blog articles offer great link opportunities.
  • Add location information to the title tag after the Encounter title variable. For example: <title><?php echo $page->title; ?> – Charlotte, NC</title>

Sample Code


	try {
		// API
		$section = new Section("API_KEY", SECTION_ID, URI_OFFSET);
		$page = $section->page;
		// $meta_keywords = $page->keywords;		
		// $meta_description = $page->description;		
		// $title = $page->title;		
		// $section_navigation = $section->subnav();		
		// $content = $page->html;		
		// $i18n_content_links = $page->language_jumpmenu();
} catch (Exception $e) { show_error("The page you are trying to access cannot be displayed."); }



subnav($path, $pre, $post, $item_pre, $item_post)

This function generates a section’s subnavigation, a list of links for each page within the current section.

  1. $path: this string is pre-pended to each link and should correspond to the parent directory
  2. $pre: this string immediately precedes the list of links; default: <p>
  3. $post: this string immediately follows the list of links; default: </p>
  4. $item_pre: this string immediately precedes each link; default: NULL
  5. $item_post: this string immediately follows each link; default: <br />



This function returns an HTML select menu listing the other languages in which this page is available. The returned string includes an on-change javascript handler which does a URL redirect to the content in the newly-selected language.


The description property contains the page’s META tag’s description content.


The html property contains the content of the page, returned as an HTML-formatted string.


The keywords property contains the page’s META tag’s keywords content.


The languages property is an array of languages the content is available in. This is used internally by language_jumpmenu() to generate the list of links to the page’s content in other languages.


The lang_code property is the code of the language currently being displayed, e.g. en, en_uk, fr, etc.


The title property contains the page’s title, e.g. “Thyroid Cancer Treatment Options”.


The url property contains the page’s name in the URI, e.g. thyroid_cancer_treatment_options,  and will correspond to the string indicated by URI_OFFSET when constructing the section. e.g. in a URL such as example.com/parent/thyroid_cancer_treatment_options/, a URI_OFFSET of 2 and $page->url both would be “thyroid_cancer_treatment_options”.

Have more questions? Submit a request