Template Class (lC_Template)

The template class (lC_Template) builds each page with the default or selected template design and controls where the elements of a page are to be shown, e.g. the header, footer, main content, side boxes, and content modules.

  • Content Classes and Content Page Files
  • Page Properties
    • Page Titles
    • Page Tags (Meta Elements)
    • Javascript
      • Javascript Blocks
      • External Javascript Files
      • Externally Built PHP Javascript


Content Classes and Content Page Files

Each page is accessed through a group based on the page requested where a content class is loaded that inspects the environment and loads a defined content page file. A content class code name can be passed as a parameter in the URL address to override the default content class from loading. The structure of a URL page request is defined as:

http://www.example.com/loadedcommerce/[GROUP].php?[CONTENT CLASS]

The group file defines a default content class to load if none is passed as a parameter in the URL address.

Content classes are responsible for inspecting the environment to load a defined content page file and are located in the following directory:

/httpdocs/loadedcommerce/includes/content/[GROUP]/[CONTENT CLASS].php

The online store index page is requested as:


This loads the default content class defined in the index group as no content class code name was passed as a parameter. The index.php file contains the following code to setup and load the defined content module:

This loads the index content class from the following directory:


If a content class code name was passed as a parameter in the URL address it would be loaded within the lC_Template::setup() class method rather than the default content class.

For example:


This will load the manufacturers content class from the index group located at:


The primary function of a content class is to inspect the environment to load a defined content page file. Content page files are located in the following directory:


A simple content class for the online store index page is:

_page_title = sprintf($lC_Language->get('index_heading'), STORE_NAME);

      if ( isset($_GET['list']) && ( $_GET['list'] == 'column' ) ) {
        $this->_page_title = $lC_Language->get('index_column_heading');
        $this->_page_contents = 'index_column.php';

The $_page_contents class variable defines a default content page to load and can be overwritten within the class constructor. By default this would load the following page content file:


Content classes are given the following class name:


The first letters of the group and content class code names are capitalized. The manufacturers content class described in a previous example would have the following class name:



Page Properties

Page Titles

The title of the page is defined in the content class $_page_title variable and can be retrieved with the getPageTitle() class method:

<?php echo $lC_Template->getPageTitle(); ?>

The existence of the page title can be checked and be externally overwritten with the hasPageTitle() and setPageTitle() class methods:

hasPageTitle() ) {
    $lC_Template->setPageTitle('New Page Title');

Page Tags (Meta Elements)

Meta elements can be associated with a page to influence search engine rankings and are placed within the section in the HTML source of the page with the getPageTags() class method:

hasPageTags() ) {
    echo $lC_Template->getPageTags();

Tags can be added to a page with the addPageTags() class method:

addPageTags('keywords', 'apples');

The first parameter is the meta group to add the meta elements to and the second parameter contains the meta element value. If multiple calls to addPageTags() are made using the same meta group, the multiple meta element values will be separated by commas when displaying the page tags.


Javascript can be added to a page in three ways and are placed within the section in the HTML source of the page. The hasJavascript() class method can check if Javascript is to be added to the page and is added with the getJavascript() class method:

hasJavascript() ) {

The three methods available to add Javascript to a page are described as follows:

Javascript Blocks

Blocks of Javascript can be added with the addJavascriptBlock() class method:



External Javascript Files

External Javascript files can be referenced to with the addJavascriptFilename() class method:


Externally Built PHP Javascript

Javascript that is built with PHP in an external file is included in the page with the addJavascriptPhpFilename() class method:



By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.