Action disabled: index
content:en_us:dev_theming_head_section

Table of Contents

Theming Head Section

The HTML page head provides a hook for including elements between the <head> tags. This is the place to pull in theme elements that will display on most or all of the pages:

  • Favorite icon
  • Style sheets / CSS
  • Javascript that is required in <head> (best practice: see Javascript)

The ClearOS theme engine uses jQuery for processing page elements. If your theme requires jQuery, there is no need to include it. You should also know that individual ClearOS Apps can pull in additional javascript and CSS. Maintaining these additional App assets is up to the developer.

Hook

The theme engine loads the core/head.php file in your theme directory and expects to find the theme_page_head hook defined. Your hook should return the necessary <head> lines for your theme.

The parameter theme_path should be used instead of hard-coding your theme path (see example). This makes it possible to map the URL and path to alternate directory locations. Why do we do this? This flexibility will allow you to test different versions of your theme without having to change any code.

Examples

function theme_page_head($theme_path)
{
    return "
<!-- Theme Favicon -->
<link href='$theme_path/images/favicon.ico' rel='shortcut icon' >
 
<!-- Theme Style Sheets -->
<link type='text/css' href='$theme_path/css/jquery-ui-1.8.5.custom.css' rel='stylesheet'>
<link type='text/css' href='$theme_path/css/superfish.css' rel='stylesheet'>
<link type='text/css' href='$theme_path/css/theme.css' rel='stylesheet'>
";
}

search?q=clearos%2C%20clearos%20content%2C%20dev%2C%20theming%2C%20maintainer_dloper&amp;btnI=lucky

content/en_us/dev_theming_head_section.txt · Last modified: 2015/03/02 17:07 by dloper