Creating Skins

From Efiction

Revision as of 03:50, 14 July 2006 by Admin (Talk | contribs)

In theory, there is no limit to the number of skins you can create for your site. If you have created skins for eFiction 1.1, you won't find many differences in 2.0 and 3.0. The number and names of the .tpl files have changed some though in later versions.

Contents

The Basics

The .tpl files

Template Variables

Items in curly brackets are variables, i.e. {output} or {authors}. They contains the actual content that will be printed out on the page. You can surround these attributes with any kind of html that you want -- font tags, tables, whatever. Some attributes are required on some of the template pages, and some are optional.

Certain template variables will only be useable on certain pages or within certain blocks while others can be placed anywhere. The page links are among the variables that can be placed anywhere on any page.

Template Blocks

These are items that generate multiple instances of content in a loop -- for example, in your index.tpl template file, you only need to indicate where the news items should display on the page with the following:

<!-- INCLUDE BLOCK : newsbox -->

This line is telling the script to include the newsbox.tpl file, and the template files will understand that it should print out several news stories in a loop, with just that one line of code.

Another kind of block you may see is the following:

<!-- START BLOCK : categoriesblock -->
{category} {description}
<!-- END BLOCK : categoriesblock -->

This is another way to include a repeating block of code. In this case, one category in a list of multiple categories.

This is similar to the included block, except that rather than pulling in the block from another file, as in the case of the newsbox.tpl, this one is just defining the block at this very moment. As you read through the individual template file instructions below and look at the actual templates, all of this will make more sense.

Block declarations should go on lines by themselves.

Changes in 2.0

Code Blocks

The template blocks in the .tpl files are not the same as the blocks you configure in the admin panel. The blocks in the admin panel are "blocks" of code that generate content they place inside template variables. The blocks in the .tpl files are "blocks" of content. While there is some overlap, thinking of them as being separate from each other will help you keep things straight. Each "code block" will generate two "content blocks": {blockname_title} and {blockname_content}. You may or may not include the {blockname_title} variable in your skin. It's up to you. However, using the {blockname_title} in your skin means if you ever want to change the title of the block you only have to do it in one place instead of in each skin. You assign which .tpl the block will be assigned to in the admin panel. There are 3 choices:

  • Inactive The block is off.
  • Active The block is active on all pages.
  • Index Only The block is only active on the index page.

You may override these settings for an individual skin by placing information for that block in the variables.php file.

These "code blocks" can be enabled/disabled, configured, and installed via the Blocks Admin panel.

How to use variables.php

How to use extra_header.php

Converting 1.1 Skins to 2.0

See Converting Skins 1.1 to 2.0

Changes in 3.0

Personal tools