InkType User Guide


Template System

InkType has a flexible and simple template system that provides full control over how your website will look.

Template File Locations

Template files are stored in two different areas within InkType:

  1. /css/template_name/
    This is where your CSS file(s), template images and template_config.php file would be stored
  2. /system/application/views/templates/template_name/
    This is where the files are stored that will display the content (index.php, post.php, category.php, page.php, search.php, etc)
Keeping the above in mind, here is an example structure we might end up with:

CSS FILES

/css/template_name/background.gif
/css/template_name/header_image.gif
/css/template_name/style.css
/css/template_name/template_config.php (required)

TEMPLATE FILES

/system/application/views/templates/template_name/category.php (required)
/system/application/views/templates/template_name/footer.php
/system/application/views/templates/template_name/header.php
/system/application/views/templates/template_name/index.php (required)
/system/application/views/templates/template_name/page.php (required)
/system/application/views/templates/template_name/post.php (required)
/system/application/views/templates/template_name/search.php (required)
/system/application/views/templates/template_name/sidebar.php

The template_config.php file

This file defines the order in which your template files are to be loaded.

A typical template layout might consist of a header, left sidebar, content area and footer.  In this case, we would set the template_config file as such:

$template_config['load_order'] = "header,sidebar,content,footer";Or maybe your template consists of a header, left sidebar, content area, right sidebar and footer:

$template_config['load_order'] = "header,sidebar_left,content,sidebar_right,footer";

The number of files and the names of the files that your template uses is up to you.  The only requirement is that your template_config.php file contains a spot reserved for "content" for the content element.

The Content Element

The above examples contain a "content" element. This tells InkType the order in which to load the main content area. InkType knows which content area to load -- all that is needed in the template_config.php file is the word "content". InkType might load the main page or it might load search results -- this depends on what the user is trying to view. The "content" element can be a number of different files, but in the template_config file it should simply be listed as "content".  More on the content element is discussed in the section below.

The Template Files

Although the template files will be named with a .php extension, they are mainly the HTML for your templates. A little PHP will be needed to make the templates work, but that is nothing to worry about - it's easy as cake!

Required template files:

  1. index.php
  2. page.php
  3. post.php
  4. category.php
  5. search.php

Your template will most likely also have a header, a footer and maybe a sidebar or two. In this case, we can create optional files (and they can be named anything):

  1. header.php
  2. footer.php
  3. left_sidebar.php
  4. right_sidebar.php

index.php

This file will display blog entries.  Unless a static page has been set up to be the default page from the admin back end, this will be your default page.

post.php

This file will display a single full post when a user clicks on a post title.  Viewing the full post will also provide a comment form for the user to leave a comment.

category.php

This file will display a list of postings that have been assigned to the selected category.

search.php

This file will display the results of a search.

page.php

This file will display static pages that have been created.