Cchost/concepts/Skins

From Creative Commons
Revision as of 10:38, 12 November 2008 by Fourstones (talk | contribs) (New page: Category:ccHost Category:ccMixter Category:Developer Category:Software Category:Technology {{cchost_head}} {{lowercase}} =Components of Skin= A skin is a composite of ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


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


Components of Skin

A skin is a composite of several template components. The main controlling file for a skin is a profile file that specifies what the different pieces are. For examples of skin profiles see ccskins/shared/profiles

Attribute Description Example
skin-file The main skin template which initializes any skin specific variables. ccskins/commons/skin.tpl
head-type Generates the <head> section of a page. ccskins/shared/head.tpl
string_profile Determines strings to use for forms, prompts, page titles, etc. ccskins/shared/strings/audio.php
list_file Template to use for an upload page. ccskins/shared/formats/upload_page_wide.php
list_files Template to use for query results. ccskins/shared/formats/upload_list_wide.tpl
form_fields Template (macro) to use for laying out single column form fields. ccskins/shared/form_fields.tpl/form_fields
grid_form_fields Template (macro) to use for laying out multiple column form fields. ccskins/shared/form_fields.tpl/grid_form_fields
tab_pos Template with tab position settings and styling. ccskins/shared/layouts/tab_pos_header.php
box_shape Template that controls box shape and styling. ccskins/shared/layouts/box_round.php
page_layout CSS template that determines position and size of content area, menus, extras (widgets) and footer. ccskins/shared/layouts/layout024.php
font_scheme CSS template that controls font family. ccskins/shared/colors/font_verdana.php
font_size CSS template that controls font size. ccskins/shared/colors/fontsize_px11.php
color_scheme CSS template that controls color selectors. ccskins/shared/colors/color_mono.php

Create a Skin Profile

You can create a new Skin Profile composed of existing skin components. To new create a new custom skin profile:

  • Log in as admin (if not already)
  • Click on Manage Site then Skin (or browse to admin/skins)
  • Select options in the Basic Settings, Layouts, and Color, Font, Text size sections.
  • Click on Save this Skin Profile (or browse to admin/skins/profile/save)
  • Fill out the form and click the Save this Skin Profile button.

Customizing Components

You can create customized version of the Upload Page and Upload Listing as described in the How User Content is Displayed section of this documentation.

You can create customized versions of many of the skin components like color schemes, string profiles and page layouts as described here. The other components (like tab_pos, font_scheme, etc.) follow the same model as the components mentioned in that section.

Customizing skin.tpl and body.tpl

In order to customize the raw CSS for body.tpl template you'll need to generate a new skin template based on an existing one.

  • Log in as admin (if not already)
  • Click on Manage Site, then Skin, then Create Skin Template (or browse to admin/skins/create)
  • Fill out the form
    • Select the skin to clone
    • Select a target directory (really, this should be <local_files>/skins
    • Enter name (NOTE: Because of a little, er, anomaly in 5.x only use lower case letters for you name. Trust us.)
  • Click on the Create a new skin button

This process creates a clone of a skin in <local_files>/skins directory.

In order to get you going, a new Skin Profile file was also created in <local_files>/skins/profiles and automatically selected as the current profile.

When your skin executes on a page request, the template engine is initialized with your skin.tpl. This is your chance to initialize any skin specific variables or mappings. (This would be a good time to get a deep understanding of how the template engine finds templates. The template engine then executes your page.tpl which should call body.tpl.

body.tpl

body.tpl is responsible for the contents of the <body> section of the page.

A properly authored body.tpl will respect the expectations of the various Skin Profile attributes. For example the tab_pos variable which suggests where the navigator tabs are to be positioned. Another example would be keeping to the CSS selectors in the color_scheme template. Perhaps the most important of these are the position selectors in the page_layout attribute in order to honor the admin's layout preferences.

The content section of the page is filled by executing the macro_names array. In order to allow templates to dynamically add items to the end of the content list you should the array_shift function in case the list changes during execution:

     if( !empty($A['macro_names'] ) )
         while( $macro = array_shift($A['macro_names']) )
             $T->Call($macro);