|
Templates
How to change the colours and fonts...»
affCAFF displays the data streams according to one of several basic
"templates" that you installed with affCAFF. These can be selected via the
data generator in the affCAFF Manager and you can
create your own templates easily: see the last section on this page for information
on how to do this.
The default installation templates comprise: "headlines only", "headlines and descriptions", "
headlines with indents", "expanding descriptions" and the special "RSS_format" template.
These are described in more detail below.
NB: In each template, text enclosed
in {squiggly brackets} is replaced by the affCAFF code when it displays each item. These
are explained further down this page in more detail, but are an essential part of each
template.
Template: Headlines Only
This simply displays a list of headlines without the full description that goes with
each item. Each headline is linked to the relevant property's website.
<div class="acItem">
<a href="{link}" class="{class}" target="{target}">{title}</a>
</div>
Template: Headlines With Indents
This does the same as the above but adds a small marker (») to the front of each
headline to make it look a little more formatted. Of course, you can copy this template
and create your own with alternative markers (see the "Creating Your Own Templates"
section below).
<div class="acItem">
<a href="{link}" class="{class}" target="{target}">» {title}</a>
</div>
Template: Headlines With Descriptions
This shows both the headline (linked) and the full text of each item below each
headline. Note: using advanced data
generation, you can truncate the descriptions (and headlines for that matter) to
a maximum length of your own choosing.
<div class="acItem">
<a href="{link}" class="{class}" target="{target}">{title}</a><br>
<div class="acDesc">{description}</div>
</div>
<br>
Template: Expanding Descriptions
This displays only the headlines but when clicked, each reveals the description
directly below the headline. Clicked a 2nd time and the description is hidden again. The main
difference here is that the link to the property's website is included at the end of the
description as the headline is needed to provide a mechanism for hiding/showing the
description.
Limitation: If you have 2 or more identical data streams (displaying
the same property) on the same page of your site, you can only use this template layout
for one of them, or else it will fail to expand the descriptions (it gets confused!).
<div class="acItem">
<a href="javascript:void('0');" class="{class}" onClick="if (document.getElementById('id{id}').style.display == 'block') { document.getElementById('id{id}').style.display = 'none'; } else { document.getElementById('id{id}').style.display = 'block'; }">{title}</a><br>
<div id="id{id}" style="display:none;margin-left:8px;" class="acDesc">{description}<br>
<a href="{link}" class="{class}" target="{target}">Visit website...</a><br><br></div>
</div>
Note that the above template uses Javascript and has been tested in Internet Explorer and Firefox, but has not been tested in minority browsers.
Template: All Text With Logos
This displays both headlines and descriptions and, where one exists, a logo for the
property whose item is being displayed. When selected, two extra parameter options appear
within the Data Generator allowing you to set the default height and width for each logo.
The maximum is 200w x 200h.
Where a logo does not exist for a property, the item will simply display as the normal
headline and description.
<div class="acItem">
<a href="{link}" class="{class}" target="{target}" title="{hint}">{title}</a>
<div class="acDesc" style="height:{height}px;">
<img src="{propertyimage}" width="{width}" height="{height}" alt="{alt}" border="1" align="left">
{description} <strong><a href="{link}" class="main" target="{target}" title="{hint}">Click here »</a></strong>
</div>
</div>
<br>
Template: RSS Format
This template is used in conjunction with the $params[outputformat]
parameter and should only be used in RSS output files. Included in your affCAFF installation is the
PHP file "acRSSOutput.php" which allows you to output streams as RSS. This is particularly useful
for blogging authors (Wordpress etc) as a method for including affCAFF data streams in posts. The
template follows standard RSS 1.0 format and looks like this:
<item rdf:about="{link}">
<dc:format>text/html</dc:format>
<dc:date>{u_datenow}</dc:date>
<dc:source>http://www.affcaff.com</dc:source>
<dc:creator>Affcaff.com</dc:creator>
<title>{title}</title>
<link>{link}</link>
<description>{description}</description>
</item>
You should also note the use of {u_datenow} in the template. This is a
user defined parameter...you can see
how it is used by looking in the file acRSSOutput.php in your affCAFF install directory.
It is used to pass through the date/time now rather than when the item was
last updated.
Understanding The Templates
Firstly, the most important thing to note: any code in the templates above can be
changed or removed (see below), so long as the {title},
{description} and {link}
references are present, as these are used by affCAFF to know where to place the data.
When affCAFF displays an item, it automatically formats the display using one of the layouts
above, with {title} and {description}
being replaced with the actual title and description on each loop. So for
example, if you display 5 items, the template above will be used 5
times - once per item. The {link}
snippet is replaced with your affiliate code for the specified property each item refers to.
The {target} tag, by default, opens each item in a
new browser window, but you can remove the whole "target=" parameter if you like.
The optional {class} tag also has a default setting. Like
the {target} tag, it can be removed or replaced.
A full list of placeholders can be found here
Creating Your Own Templates
We strongly recommend that rather than editing the default templates, you create new ones -
if necessary by copying an existing one into a new file, or from scratch. This is because, in
the admittedly unlikely event of a bug being reported, we may need to fix a template. Minor
fixes like this are automatically applied to your affCAFF installation and would overwrite the
existing one.
This only applies to default templates supplied by affCAFF.
Templates are ".inc" files and located in your "affCAFF/acTemplates" installation
directory. When you copy them, ensure at least the {title},
{description} (optionally) and
{link} references are left in place.
Create your new templates with the ".inc" extension and place them
in the "affCAFF/acTemplates" directory if you wish to. Again,
you need to maintain the references to {title},
{description} and {link}.
Placing them in the directory above will ensure that they appear for selection in
the dropdown menu in the data generator within
affCAFF Manager. If you name them logically, using the _ (underscore) character
instead of spaces like we have, the names will make more sense in your dropdown box
(ie: the default template "headlines_with_descriptions.inc" is read as
"Headlines With Descriptions" in the dropdown menu in the Data Generator).
Finally, you can devise and add your own {parameters} which could be useful for
extra font, colour or appearance variations. For more information on this, go to the
Define Your Own Parameters section.
|