Cchost/Static HTML Pages

From Creative Commons
Jump to: navigation, search

Docs Home Install Upgrade Troubleshoot Customize Admins Devs Content Query Templates Commands Skins

The easiest way to create pages is to author them directly in ccHost.

However if you have HTML pages authored outside ccHost you can add pages 'manually' into your system.

  1. Create a file with either a html or php extension
  2. Place the file into <local_files>/pages
  3. To see your page, browse to <your_installation_root>/docs/<filename_without_extension>

The command for viewing documents is docs (or alias viewfile). The parameter is the name of a PHP file in <local_files>/pages (Admins control what the actual path is in the 'docs Path' found in Global Settings -> Paths (admin/paths).

For example, create a file <local_files>/pages/credits.php

You can display that file via:   OR

(Leave off the PHP from the URL command)

Since the docs command is the default command you don't even have to specify the command in the browser.

Not strictly 'static'

For PHP developers there are actually several dozen variables and a template-safe set of PHP calls immediately available.

Inspecting available variables

All of the variables available are in a variable called $A for 'array'. You can dump these by putting the following code into your PHP script:


Template functions available

The template object used to render your page is a variable called $T for 'template'.

Some method of interest may be:

 // To embed the results of another template in the system:

 // To use a ccHost string lookup ('str_' prefix)
 // You can also pass variable argument list ala sprintf

 // To find a file in the skins locations (include javascript,
 // css and images)


There are a set of template friendly PHP functions you could use:

 // returns an array of settings from config

 // embeds a query directly into the page

 // chop a string and append an ellipse