Development » API Functions » Miscellaneous functions

Other API functions

Miscellaneous functions

getSnippetName()

  // returns the textual name of the calling snippet

clearCache()

  // deletes all cached documents from the ./assets/acahe directory

makeUrl($id, $alias=0, $args='')

  // Modified by mikef
  // returns a properly formatted URL as of 0.6.1 Final
  // $id is a valid document id
  // $alias is now an unused parameter because it is now calculated based on $id
  // $args is a URL compliant text string of $_GET key=value pairs
  // Example: makeURL(45,'','?cms=Etomite')

getConfig($name='')

  // returns the requested configuration setting_value to caller
  // based on $key=>$value records stored in system_settings table
  // $name can be any valid setting_name
  // Example: getConfig('site_name')

getVersionData()

  // returns a $key=>$value array of software package information to caller

getKeywords($id=0)

  // returns a single dimensional array of document specific keywords
  // $id is the identifier of the document for which keywords have been requested

runSnippet($snippetName, $params=array())

  // returns the processed results of a snippet to the caller
  // $snippetName = name of the snippet to process
  // $params = array of $key=>$value parameter pairs passed to the snippet

getChunk($chunkName)

  // returns the contents of a cached chunk as code
  // $chunkName = textual name of the chunk to be returned

putChunk($chunkName)

  // at present this is only an alias of getChunk() and is not used

This function should not be used in new snippets.

parseChunk($chunkName, $chunkArr, $prefix="{", $suffix="}")

  // returns chunk code with marker tags replaced with $key=>$value values
  // $chunkName = the textual name of the chunk to be parsed
  // $chunkArr = a single dimensional $key=>$value array of tags and values
  // $prefix and $suffix = tag begin and end markers which can be customized when called

getUserData()

  // returns user agent related (browser) info in a $key=>$value array using the phpSniff class
  // can be used to perform conditional operations based on visitors browser specifics
  // items returned: see code

getSiteStats()

  // returns a single dimensional $key=>$value array of the visitor log totals
  // array $keys are  today, month, piDay, piMonth, piAll, viDay, viMonth, viAll, visDay, visMonth, visAll
  // today = date in YYYY-MM-DD format
  // month = two digit month (01-12)
  // pi = page impressions per Day, Month, All
  // vi = total visits
  // vis = unique visitors