Expression Engine - templates

Unlike many other Content Management Systems, Expression Engine makes no assumptions about how you should build your site. Built around a combination of XHTML, CSS and EE’s tag system this means you have total freedom to design and present your content in just about any combination imaginable - a web designers dream!

Templates - the basics

Think of a template as a placeholder for your text and images, when you add your text and images it becomes a complete web page. The only difference is that one template can be reused many times to show different content because EE inserts it for you dynamically, and therefore the same template can be used to present an infinite number of pages.

If your site is very basic you might only need one template, conversely if your site is complex and has many different types of content you might use a dozen or more.

For example here is a list of templates that might be used on a typical articles site:

  • A template for your home page
  • A template that holds category listings and article summaries
  • A template that holds the full article text
  • A template for your “about us” page
  • A template for your contact page

Templates - the structure

Each set of templates lives in a “Template Group”. There is one default group that contains your sites home page template but apart from that you can create as many different groups as you need, for example you want different groups for main site, gallery, and news like this…

Default group
- home page template
Gallery group
- gallery main page template
- thumbs page template
- full image template
News group
- news main page template
- news category page template
- full article template

Alternatively you can create additional templates inside each group:

Default group
- home page template
- gallery main page template
- thumbs page template
- full image template
- news main page template
- news category page template
- full article template

Templates - advanced

For those of you that are familiar with Server Side Includes you’ll be glad to know that Expression Engine makes this incredibly easy to do using the embed tag, so you can reuse common page elements such as headers, footers, menus and the like.

There are 6 types of template you can create:

Webpage - this most common type of Template
CSS -  used for Stylesheets
RSS - used for RSS and Atom syndication feeds
JavaScript - used for outputting JavaScript code
Static - used for static HTML or text content, no rendered tags
XML - used for outputting XML pages and data

When creating a new group or template you have the option of duplicating an existing group or template - this makes a great time saver!

A word on Global Variables

These are snippets of text or code (except EE tags and PHP) that you can display anwhere in your templates. Commonly used for things like addresses, phone numbers, default meta tags/titles, advertising code (ie Google adwords code), copyright etc.

Editing templates

As you’d expect you can edit all your templates online via the admin interface, or you can save them to files for editing offline in your favourite editor. You can choose to save template revisions should you need to roll back to a previous version at any time.

You won’t find many pre-made templates for Expression Engine but anyone with a fair understanding of HTML and CSS will be able to convert virtually any ready made template to work.

That’s about it for a template overview, I’ll be covering Template tags in the next article. The best way to try out the templating system is to download the Free Core Version and play with it!.