Formatting the output

Created: Dec 11, 2007

The output file generated by LinkEX, can be formatted in many ways. In this section I will explain how to archive your desired output.

Each output is actually the "sum" of [the category definition] + [the links assigned to the category] resulting in a file named after the category id.

When LinkEX is installed, one default category is predefined. This category is straight forward and works fine for most sites. You can create as many categories as you need, and each link can be assigned to any of the existing categories.

You can decide to have your categories public, and allow the webmaster who is adding his link, to select the category, or you can select a set of default categories a new link will be assigned to.
This is all controlled under the Settings » Category settings.

Category definition

There are a numerous of configuration options under each category, this sections takes you through them all.

Name this is simply a name describing the category. It is used throughout the LinkEX interface.

Link filter is used to control which links that are assigned to the category is actually included in the output. This is based on the status of the link.

Order controls the sorting of the links before generating the output.
The options should be self-explaining, except perhaps the Random one.
If you select the Random LinkEX will shuffle the links before generating the output, but keep in mind that the output is only generated when needed (a link or the category is modified), not each time someone visits your site, so you will only see a change in order when the output is re-generated.

Public this is only used when you choose to have your categories public available, with this settings, you can make a category non-public even though the categories are public.

Template see the section below.

Links pr. file allows you to have several output files created for a category.
When the value is 0 (zero) only one output file will be created having all the links in it.
If you enter a number, LinkEX will also create CEIL( [number of links in category] / [links pr. file] ) files, named [CategoryID]-1, [CategoryID]-2, [CategoryID]-3, etc etc.
You can also enter a list of numbers separated by comma, eg 5,10,10 this instructs LinkEX to create one file [CategoryID]-1 having the first 5 links, [CategoryID]-2 having the next 10 links and [CategoryID]-3 having the next 10 links.
This setup could leave you with a category where not all links are included in any of your output files, so you can leave the last element of the list blank, ending with a comma, eg 5,10,. This instructs LinkEX to put the rest of the links remaining in the category into the last output file.

Template

The template field is used to define how each link should be presented. The pseudo code for generation the output is something like this:

- get all the links assigned to this category
- filter out all the links based on their status
- sort the links as defined
foreach of the links:
  - apply the template to the link data
  - append the result to the output file

as you can see the template is used once for each link. This is important to know, when configuring the actual template.

The default template in LinkEX is:
<a href="{$URL}" title="{$ANCHOR}">{$ANCHOR}</a>&nbsp;{$DESCRIPTION}&nbsp;