Cchost/Static HTML Pages

From Creative Commons
Revision as of 21:05, 6 November 2008 by Fourstones (talk | contribs) (New page: Category:ccHost Category:ccMixter Category:Developer Category:Software Category:Technology {{draft}} {{lowercase}} =Are you sure you don't want to use the Content Mana...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Are you sure you don't want to use the Content Manager?

Before adding static HTML pages into your ccHost site, considering the new ccHost Content Manager to create and maintain static content.

OK, you're sure

If that doesn't do it for you then you can add pages 'manually' in the following way:

  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>

Note that 'docs' is an alias for the 'viewfile' command and therefore they are interchangeable with each other.

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