Difference between revisions of "Cchost/Static HTML Pages"

From Creative Commons
Jump to: navigation, search
(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...)
 
 
Line 4: Line 4:
 
[[Category:Software]]
 
[[Category:Software]]
 
[[Category:Technology]]
 
[[Category:Technology]]
{{draft}}
+
{{cchost_head}}
 
{{lowercase}}
 
{{lowercase}}
  
=Are you sure you don't want to use the Content Manager?=
+
The easiest way to create pages is to author them [[cchost/admin/Content_Manager|directly in ccHost]].
Before adding static HTML pages into your ccHost site, considering the new ccHost [[cchost/admin/Content_Manager|Content Manager]] to create and maintain static content.
 
  
=OK, you're sure=
+
However if you have HTML pages authored outside ccHost you can add pages 'manually' into your system.
If that doesn't do it for you then you can add pages 'manually' in the following way:
 
  
 
#Create a file with either a ''html'' or  ''php'' extension
 
#Create a file with either a ''html'' or  ''php'' extension
Line 17: Line 15:
 
#To see your page, browse to '''<your_installation_root>/docs/<filename_without_extension>'''
 
#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.
+
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:
 +
 
 +
  http://ccmixter.org/viewfile/credits  OR
 +
  http://ccmixter.org/docs/credits
 +
 
 +
(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.
 +
 
 +
  http://ccmixter.org/credits
  
 
==Not strictly 'static'==
 
==Not strictly 'static'==

Latest revision as of 10:53, 12 November 2008


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:

 http://ccmixter.org/viewfile/credits   OR
 http://ccmixter.org/docs/credits

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

 http://ccmixter.org/credits

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:

 <?
    CCDebug::Enable(true);
    CCDebug::PrintVar($A);
 ?>

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:

 $T->Call('path_to_template_file_or_macro');
 // To use a ccHost string lookup ('str_' prefix)
 // You can also pass variable argument list ala sprintf

 $T->String('string_id');
 // To find a file in the skins locations (include javascript,
 // css and images)

 $T->URL('partial_path_to_file');

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

 // returns an array of settings from config
 cc_get_config($configName)

 // embeds a query directly into the page
 cc_query_fmt($qstring,$debug=0)

 // chop a string and append an ellipse
 cc_strchop($str,$maxlen)