Templates Guide

This template is designed to help you better understand the way the template or theme system works in 68 Classifieds.

Directory Structure

All templates are located in the templates folder and each one needs to be inside its on folder.

For example if you are building a new template and going to name it bluenew then your structure would look like this:

The only required files for your layout are layout.tpl and a stylesheet file.

Creating a new template

When creating a new template you should first create a new folder inside the “templates” directory.

The majority of the layout is handled through two files and they are layout.tpl and style.css so you would take these two files and add them to your new folder.

Now you can upload this folder and these files then change your template in administration → main settings and you will have a new look to your website.

If you look at your site and see another page you would like to modify but are unsure which template file it is you can add

{debug}

to the layout.tpl file. Then visit the page again and a pop up will appear giving you information about the template files in use as well as a list of all the variables available for the page.

Once you get the file name you can then copy that file out of the default template folder and move it into your new folder.

68 Classifieds works by using two template paths. The one you have defined and the default template folder. So if it can't find a file in your template folder it will use the default. Please Note: This only applies to .tpl files. Images and/or other files will not be picked up unless specifically referenced.

Reference

Conditional Tags

The Conditional Tags can be used in your Template files to change what content is displayed and how that content is displayed on a particular page depending on what conditions that page matches. For example, you might want to welcome a logged in site visitor with a nice friendly greeting.

if $smarty.session.username<>""} Welcome back {$smarty.session.username} {/if}

That may look pretty complex but actually it is very simple once you get your head around. The first portion {if $smarty.session.username<>””} checks to make sure they are logged in and their username is not blank. Next the welcome back portion just prints their name if the first condition is true.

Reference