The directory templates are the templates that control the appearance of your link directory which surfers will be viewing. This document will give you an overview of the custom functions and variables available in each of the directory templates.
Editing Directory Templates
To edit the directory templates access the Templates > Directory Templates function from the control panel menu. This will display a page where you can select which template you want to edit. Once you have selected the template you want to edit, press the Load Template button. You will be returned to the same page, but there will now be a large text box where you can make changes to the template. When you are done making changes, press the Save Template button to save your changes.
Custom Functions
In addition to the standard template functions, the directory templates have several custom functions available which allow you to display catgories, links, news items, etc. Each of those custom functions are described here.
-
{ad}
-
order (optional, defaults to times_displayed, (unique_clicks/times_displayed) DESC)
The order in which advertisements will be pulled from the database. The following order options are available:
times_displayed | The number of times the advertisements has been displayed |
raw_clicks | The number of raw clicks the advertisement has received |
unique_clicks | The number of unique clicks the advertisement has received |
weight | The weight value assigned to the advertisement |
All of these values can be modified with DESC to sort in descending order instead of ascending order. Additionally, these values may be combined together to generate sub-sorting options. Here are a few examples: |
|
raw_clicks DESC | Sort by the number of raw clicks on the advertisement, from most to least |
weight DESC | Sort by the weight assigned to the advertisement, from largest to smallest |
(unique_clicks/times_displayed) DESC | A productivity value taking into account the number of times the advertisement has been displayed and the number of unique clicks it has received. Ordered from most productive to least productive. |
weight (optional, defaults to any)
Use this option to specify what advertisement weights can be pulled for display. You can use any type of comparison operator here, followed by the weight value that you want to restrict. Below are all of the comparison options you can use. Note that you are not restricted to using 10, that is only there as an example. You can use any valid weight value in it's place.
-
weight="= 10"
Pull galleries that have a weight of exactly 10
weight="!= 10"
Pull galleries that have a weight which is anything except 10
weight="> 10"
Pull galleries that have a weight greater than 10
weight="< 10"
Pull galleries that have a weight less than 10
weight=">= 10"
Pull galleries that have a weight greater than or equal to 10
weight="<= 10"
Pull galleries that have a weight less than or equal to 10
tags (optional)
Use this option to specify a boolean mode search term in the tags assigned to your advertisements. Here are some examples:
-
tags=main
Pull pages that have the word main in their tag list
tags=movies videos
Pull pages that have either the word movies or videos in their tag list
tags=+movies +main
Pull pages that have both the word movies and main in their tag list
tags=movies -main
Pull pages that have the word movies but not the word main in their tag list
pagedupes (optional, defaults false)
Use this option to specify whether or not advertisements which have already been displayed on this page can be pulled for display again on this page. If you set this to true, repeats will be allowed. Setting this to false means that no repeats will be allowed.
{searches}
-
var (required)
The name of the template variable that the search data will be loaded into
amount (optional, defaults to all)
Specify a numerical value to limit the number of search terms that are pulled, or enter the text string all to have all search terms pulled
order (optional, defaults to searches DESC)
The order in which the searches will be displayed. The following order options are available:
term | Sort alphabetically by the search term itself |
searches | Sort numerically by the number of searches that have been executed for each term |
date_last_search | Sort by the date that this term was most recently searched for |
All of these values can be modified with DESC to sort in descending order instead of ascending order. Additionally, these values may be combined together to generate sub-sorting options. Here are a few examples: |
|
searches DESC | Sort by the number of searches that have been executed, from most to least |
date_last_search DESC | Sort by the date that this term was most recently searched for, from newest to oldest |
searches DESC, date_last_search DESC | Sort by the number of searches that have been executed, from most to least. If two search terms have the same number of searches, they will be sub-sorted by the date that this term was most recently searched for, from newest to oldest |
alphabetize (optional, defaults to false)
true or false. If this is set to true, the search terms will be alphabetized after having the order sorting option applied. If set to false, no alphabetizing will be applied. This is useful, for example, if you want to pull the to 50 most searched terms but display them alphabetized rather than in order of how many searches have been performed for each.
{categories}
-
directory-category.tpl
directory-index.tpl
This template function has a number of attributes that you can specify to control how this function operates. Each of those attributes are described below.
-
var - The name of the template variable that the categories will be loaded into
order - The order in which the categories will be displayed (explained below)
parent - The parent category; the sub-categories of this category will be loaded
amount - The maximum number of categories to load
related - Include this option and set it to true to display the related categories of a specific category
The order attribute allows you to specify how the categories should be sorted when they are displayed. There are a few different sorting options you can use, each of which are described below.
-
name - Sort alphabetically by the category name
links - Sort by the number of links in the category, from least to most
links DESC - Sort by the number of links in the category, from most to least
subcategories - Sort by the number of sub-categories this category has, from least to most
subcategories DESC - Sort by the number of sub-categories this category has, from most to least
RAND() - Sort randomly
{links}
-
directory-index.tpl
directory-category.tpl
directory-new.tpl
directory-popular.tpl
directory-search.tpl
directory-top-rated.tpl
This template function has a number of attributes that you can specify to control how this function operates. Each of those attributes are described below.
-
var - The name of the template variable that the links will be loaded into
order - The order in which the links will be displayed (explained below)
type - The type of links to display (explained below)
amount - The maximum number of links to load (explained below)
perpage - The maximum number of links to display per page (explained below)
category - The category to pull links from
The type attribute of this function will determine the type of links displayed, and only certain types can be displayed on certain templates. The available type options, including the templates they can be used on, are described below.
-
regular - Loads regular and premium links; valid on directory-category.tpl
featured - Loads featured links; valid on directory-category.tpl
top - Loads the top rated links; valid on directory-index.tpl and directory-top.tpl
new - Loads the newest links; valid on directory-index.tpl and directory-new.tpl
popular - Loads the most clicked links; valid on directory-index.tpl and directory-popular.tpl
search - Loads the links that match the search term entered; valid on directory-search.tpl
The amount attribute of this function will limit the number of links that are loaded for the top, new, and popular types. So, for example, if you wanted to load the 5 newest links you would set the type to new and the amount to 5.
The perpage attribute of this function allows for automatic pagination on the directory-category.tpl and directory-search.tpl templates. It is valid in {links} template tags where the type is set to regular or search. For example, if you set this to 20 on the directory-search.tpl template, this will display 20 search results per page. Using additional template tags you will be able to automatically create links to the other pages of results.
The category attribute allows you to specify the category from which the links will be pulled. On the directory-category.tpl template you do not need to use this attribute, as the software automatically knows which category topull the links from. This can be used on other pages, however, to display links from a specific category. The category can be specified as it's ID number or using a template variable that has been assigned a category (such as from the {categories} template function).
The order attribute allows you to specify how the links should be sorted when they are displayed. This attribute can be used in {links} tags where the type is set to regular, featured, or search. There are a few different sorting options you can use, each of which are described below.
-
title - Sort alphabetically by the site title
clicks - Sort by the number of clicks the link has received, from least to most
clicks DESC - Sort by the number of clicks the link has received, from most to least
ratings - Sort by the number of ratings the link has received, from least to most
ratings DESC - Sort by the number of ratings the link has received, from most to least
rating_avg - Sort by the average rating the link has received, from lowest to highest
rating_avg DESC - Sort by the average rating the link has received, from highest to lowest
weight - Sort by the weight assigned to the link, from lowest to highest
weight DESC - Sort by the weight assigned to the link, from highest to lowest
date_added - Sort by the date when the link was added, from oldest to newest
date_added DESC - Sort by the date when the link was added, from newest to oldest
date_modified - Sort by the date when the link was last modified, from oldest to newest
date_modified DESC - Sort by the date when the link was last modified, from newest to oldest
RAND() - Sort randomly
{news}
-
directory-index.tpl
directory-category.tpl
directory-new.tpl
directory-popular.tpl
directory-top-rated.tpl
This template function has a couple of attributes that you can specify to control how this function operates. Each of those attributes are described below.
-
var - The name of the template variable that the news items will be loaded into
amount - The maximum number of news items to load
News items will automatically be sorted by the date assigned to them, from newest to oldest. So, for example, if you set the amount value to 5, this will load the 5 newest news items.
There are some variables that get used in multiple templates, so to avoid describing them for every template they appear in, the are described in this section.
-
{$config}
This template value contains the LinkX configuration settings.
{$config.base_url} - Base URL setting
{$config.cookie_domain} - Cookie Domain setting
{$config.from_email} - E-mail Address setting
{$config.from_email_name} - E-mail Name setting
{$config.page_new} - New Links Page setting
{$config.page_popular} - Popular Links Page setting
{$config.page_top} - Top Links Page setting
{$config.page_details} - Link Details Page setting
{$config.extension} - File Extension setting
{$config.date_format} - Date Format setting
{$config.time_format} - Time Format setting
{$config.timezone} - Timezone setting
{$config.dec_point} - Decimal Point setting
{$config.thousands_sep} - Thousands Separator setting
{$config.mod_rewrite} - Use mod_rewrite to create search engine friendly URLs setting
{$config.custom_categories} - Using custom templates for category pages setting
{$config.min_desc_length} - Min Description Length setting
{$config.max_desc_length} - Max Description Length setting
{$config.min_title_length} - Min Title Length setting
{$config.max_title_length} - Max Title Length setting
{$config.max_keywords} - Keywords Allowed setting
{$config.link_weight} - Default Link Weight setting
{$config.allow_redirect} - Allow URL redirection setting
{$config.recip_required} - Require a reciprocal link setting
{$config.user_for_links} - Only registered users can submit links setting
{$config.email_links} - Send confirmation e-mail message to new links setting
{$config.confirm_links} - New links must be confirmed through e-mail before activation setting
{$config.approve_link_edits} - Edited links must be approved by an administrator before activation setting
{$config.min_comment_length} - Min Comment Length setting
{$config.max_comment_length} - Max Comment Length setting
{$config.comment_delay} - Comment Delay setting
{$config.user_for_comments} - Only registered users can leave comments for links setting
{$config.approve_comments} - New comments must be approved by an administrator before display setting
{$config.max_rating} - Maximum Rating setting
{$config.user_for_rate} - Only registered users can rate links setting
{$config.email_accounts} - Send confirmation e-mail message to new accounts setting
{$config.confirm_accounts} - New accounts must be confirmed through e-mail before activation setting
{$config.approve_accounts} - New accounts must be approved by an administrator before activation setting
{$config.dsbl_link} - Check dsbl.org for banned IP addresses during link submission setting
{$config.dsbl_rate} - Check dsbl.org for banned IP addresses during link rating setting
{$config.dsbl_comment} - Check dsbl.org for banned IP addresses during link comment submission setting
{$config.dsbl_account} - Check dsbl.org for banned IP addresses during account creation setting
{$config.dsbl_report} - Check dsbl.org for banned IP addresses during bad link reporting setting
{$config.font_dir} - Font Directory setting
{$config.min_code_length} - Min Code Length setting
{$config.max_code_length} - Max Code Length setting
{$config.use_words} - Use words file for verification codes setting
{$config.link_captcha} - Require verification code on link submission form setting
{$config.account_captcha} - Require verification code on account signup form setting
{$config.rate_captcha} - Require verification code to rate links setting
{$config.comments_captcha} - Require verification code to leave comments setting
{$config.cache_index} - Index Page Cache setting
{$config.cache_category} - Category Page Cache setting
{$config.cache_new} - New Links Page Cache setting
{$config.cache_popular} - Popular Links Page Cache setting
{$config.cache_top} - Top Links Page Cache setting
{$config.cache_search} - Search Page Cache setting
{$config.cache_details} - Details Page Cache setting
{$config.logged_in} - A session value specifying whether the user is logged into their account
{$account}
This template value contains the user account data for a specific account.
{$account.username} - The account's username
{$account.password} - The account's password (this is only valid on the account-created.tpl template)
{$account.email} - The e-mail address associated with the account
{$account.name} - The name associated with the account
In addition to these default values, all of your user defined account fields will be available from this template value as well. So, for example, if you create a user defined field with the name icq_number you can access this value using {$account.icq_number}
{$category}
This template value contains the data for a specific category. Each item of a template variable set with the {categories} function contains these values.
{$category.category_id} - The unique ID number assigned to this category
{$category.name} - The name of this category
{$category.description} - The description assigned to this category
{$category.meta_description} - The meta description assigned to this category
{$category.meta_keywords} - The meta keywords assigned to this category
{$category.parent_id} - The ID number of the parent of this category
{$category.path} - The path to this category for use in URLs when using mod_rewrite
{$category.path_parts} - An array containing the names of all the categories in this category's path
{$category.template} - The custom template filename assigned to this category
{$category.crosslink_id} - The ID number of the category this points to, if any
{$category.related_ids} - The ID numbers of the categories this category is related to
{$category.subcategories} - The number of sub-categories this category contains
{$category.links} - The number of links this category contains
{$category.status} - The status of this category
{$link}
This template value contains the data for a specific link. Each item of a template variable set with the {links} function contains these values.
{$link.link_id} - The unique ID number assigned to this link
{$link.site_url} - The site URL for this link
{$link.recip_url} - The recip URL for this link
{$link.title} - The title assigned to this link
{$link.description} - The descrition assigned to this link
{$link.type} - The type of link (one of regular, premium, or featured)
{$link.expires} - The expiration date of this link when it changes from premium or featured back to regular
{$link.name} - The name associated with this link
{$link.email} - The e-mail address associated with this link
{$link.keywords} - The keywords assigned to this link
{$link.clicks} - The number of clicks this link has received
{$link.comments} - The number of comments this link has received
{$link.ratings} - The number of ratings this link has received
{$link.rating_avg} - The average rating this link has received
{$link.weight} - The weight value assigned to this link
{$link.date_added} - The timestamp when this link was added
{$link.date_modified} - The timestamp when this link was last modified
{$link.icons} - The icon HTML code assigned to this link
{$link.username} - The username of the account that submitted this link, if any
{$link.has_recip} - An indicator of whether this link has a reciprocal link to your site
In addition to these default values, all of your user defined link fields will be available from this template value as well. So, for example, if you create a user defined field with the name icq_number you can access this value using {$link.icq_number}
{$news}
This template value contains the data for a news item.
{$news.headline} - The headline of the news item
{$news.body} - The full text of the news item
{$news.date_added} - The timestamp when the news item was added
In addition to these default values, all of your user defined account fields will be available from this template value as well. So, for example, if you create a user defined field with the name icq_number you can access this value using {$account.icq_number}
{$pagination}
This template value contains details on the pagination (multiple pages of links or search results) available for the page being viewed.
{$pagination.prev} - An indicator of whether there is a previous page of results
{$pagination.next} - An indicator of whether there is a next page of results
{$pagination.start} - The starting position of results displayed on this page
{$pagination.end} - The ending position of results displayed on this page
{$pagination.total} - The total number of results
%%Powered_By%%
Removing or making the powered by link invisible to surfers is a violation of the software license agreement and will result in license termination.
The powered by link can only be removed if you have purchased the link removal license.
This is a special template value which does not conform to the standard format. It is not necessary to enclose this template value in curly braces. This will control where the Powered By LinkX link appears on your pages. If you remove this template value, the powered by link will automatically be placed on your page before the closing </body> tag.
This section will describe all of the available templates and the variables you can use within each template.
-
account-created.tpl
This template is displayed to the user during the account registration process after their account has been created
-
{$status} - The account status; one of unconfirmed, pending, or active
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$account} - The account data; see the Common Variables section for details
{$user_fields} - The user defined fields for this account (array value)
account-edit.tpl
This template is displayed when a user wishes to edit their account
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$account} - The account data; see the Common Variables section for details
{$user_fields} - The user defined fields for this account (array value)
{$errors} - If any errors were encountered when editing the account, this value will contain them
account-forgot-confirm.tpl
This template is displayed when a user has entered their e-mail address to locate their lost account login information and the software has found a matching account.
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$account} - The account data; see the Common Variables section for details
account-forgot-confirmed.tpl
This template value is displayed when a user has lost their login information and requested that they be reminded. A confirmation e-mail will be sent to them and will contain a link to a page that they must visit to get a new password for their account. This page is displayed when they click on the link in that e-mail message.
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$account} - The account data; see the Common Variables section for details
{$error} - If any errors were encountered with the confirmation link, this value will contain them
account-forgot.tpl
This template will be displayed when a user has lost their login information and they will need to enter their e-mail address in the form on this page.
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$errors} - If any errors were encountered, this value will contain them
account-login.tpl
This template will display the account login screen.
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$errors} - If any errors were encountered, this value will contain them
{$request.login_username} - The username that was entered on the login form
{$request.login_password} - The password that was etnered on the login form
{$request.u} - The URL that the user came from, so they can be redirected there once they login
account-logout.tpl
This template will display the account logout confirmation screen.
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$http_referrer} - The URL that the user came from, so they can be redirected there once they logout
account-overview.tpl
This template will be shown after the user logs in and will contain their account information and the links they have submitted
-
{$message} - This will be set to accountupdate if the user just edited their account
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$account} - The account data; see the Common Variables section for details
{$links} - The links this account has submitted (array value); each item will contain the {$link} Common Variables values
account-register.tpl
This template will be shown when a user wants to create a new account; this is the account signup form
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$account} - The account data entered in the registration form; see the Common Variables section for details
{$user_fields} - The user defined fields for this account (array value)
directory-category.tpl
This template will be shown when a surfer selects to view a specific category. This page will be used to display the sub-categories and links within a category.
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$this_category} - The current category being viewed; same values as the {$category} Common Variable
{$pagination} - The pagination values for this page; see the Common Variables section for details
Each item from variables loaded by the {links} function will contain the {$link} Common Variables values
Each item from variables loaded by the {categories} function will contain the {$category} Common Variables values
directory-index.tpl
This is the main link directory page that will contain the list of root level categories.
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$total_categories} - The total number of categories in the database
{$total_links} - The total number of links in the database
{$index_page} - A value indicating that this is the index page that is being viewed
Each item from variables loaded by the {links} function will contain the {$link} Common Variables values
Each item from variables loaded by the {categories} function will contain the {$category} Common Variables values
directory-link-details.tpl
This is the template that will display the details for a specific link
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$categories} - The categories this link is in (array value); each item will contain the {$category} Common Variables values
{$link} - The link data; see the Common Variables section for details
{$user_fields} - The user defined fields for this link
{$message} - Set to 'rated' if the user just rated this link, or 'commented' if the user just submitted a comment
{$logged_in} - An indicator of whether the user viewing this page is logged in
{$comments} - The comments this link has received (array value)
{$ref_url} - The URL of this page so that a user can return to it after logging in
Each item in the {$comments} array will have these values (assuming comment was used for the variable name):
{$comment.comment_id} - The unique ID number assigned to this comment
{$comment.username} - The username of the account that submitted this comment, if any
{$comment.email} - The e-mail address submitted with this comment
{$comment.name} - The name submitted with this comment
{$comment.submit_ip} - The IP address used to submit this comment
{$comment.date_added} - The timestamp of when this comment was added
{$comment.comment} - The comment itself
directory-new.tpl
This template will display the most recently added links
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
Each item from variables loaded by the {links} function will contain the {$link} Common Variables values
directory-popular.tpl
This template will display the most clicked links
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
Each item from variables loaded by the {links} function will contain the {$link} Common Variables values
directory-search.tpl
This template will display the search results
-
{$search_too_short} - An indicator of whether the search term they entered was too short (too few characters)
{$pagination} - The pagination values for the search results; see the Common Variables section for details
{$search_term} - The search term that was entered by the user
{$config} - The LinkX configuration settings; see the Common Variables section for details
Each item from variables loaded by the {links} function will contain the {$link} Common Variables values
directory-top-rated.tpl
This template will display the top rated links
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
Each item from variables loaded by the {links} function will contain the {$link} Common Variables values
global-header.tpl
This is the global header that will be included at the top of all of the other templates.
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$index_page} - This value will be set to true if the user is viewing the main page of your link directory
{$this_category} - The current category being viewed, if on a category page; same values as the {$category} Common Variable
global-footer.tpl
This is the global footer that will be included at the bottom of all of the other templates.
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$index_page} - This value will be set to true if the user is viewing the main page of your link directory
{$this_category} - The current category being viewed, if on a category page; same values as the {$category} Common Variable
error-fatal.tpl
This template will be displayed when a fatal, unrecoverable error has occurred.
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$error} - The error message
{$trace} - A stack trace showing what functions were called
{$file} - The file that the error occurred in
{$line} - The line number where the error occurred
error-nice.tpl
This template will be displayed when the user has done some action to trigger an error condition
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$error} - The error message
report-submit.tpl
This template will be displayed when the user wants to report a broken or cheating link
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$errors} - Any error messages that indicate a problem with the information submitted
{$report} - The message that the user is sending as the report for this link
{$link} - The link data for the link being reported; see the Common Variables section for details
report-submitted.tpl
This template will be displayed to confirm that the user's report has been submitted
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$link} - The link data for the link being reported; see the Common Variables section for details
style.css
This is the stylesheet that is used throughout the directory templates
-
No template variables
submit-add.tpl
This template will display a form so that users can submit their links
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$errors} - Any error messages that indicate a problem with the information submitted
{$account} - The account data, if the user is logged in; see the Common Variables section for details
{$ref_url} - The URL to this page, which will be used to return the user to this page if they need to go login first
{$categories} - The categories you have defined (array value; only set if you have 200 or less categories)
{$category} - The category the user has selected to add this link to (only set if you have more than 200 categories)
{$user_fields} - The user defined link fields
{$link} - The link data that the user has submitted; see the Common Variables section for details
submit-added.tpl
This template is displayed when the user has successfully submitted their link data
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$status} - The status assigned to this link (one of unconfirmed, pending, or active)
{$category} - The category the user has selected to add this link to
{$user_fields} - The user defined link fields
{$link} - The link data that the user has submitted; see the Common Variables section for details
submit-edit-login.tpl
The login screen displayed when a user wants to edit their link information but they do not have an account
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$errors} - Any error messages that indicate a problem with the information submitted
{$request.login_site_url} - The site URL entered on the login form
{$request.login_email} - The e-mail address entered on the login form
{$request.login_password} - The password entered on the login form
submit-edit.tpl
This template will be displayed allowing a user to edit their link information
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$errors} - Any error messages that indicate a problem with the information submitted
{$account} - The account data, if the user is logged in; see the Common Variables section for details
{$link} - The link data; see the Common Variables section for details
{$user_fields} - The user defined link fields
{$login_site_url} - The site URL entered on the login form
{$login_email} - The e-mail address entered on the login form
{$login_password} - The password entered on the login form
submit-edited.tpl
This template is displayed to confirm that the user modifications have been recorded
-
{$config} - The LinkX configuration settings; see the Common Variables section for details
{$link} - The link data; see the Common Variables section for details {$user_fields} - The user defined link fields
{$categories} - The catgories this link is in (array value)
submit-info.tpl
This template will be displayed if the user needs to login to submit a link or if they need to locate the category for their link and click on the link submission link from that category page.
-
{$config} - The LinkX configuration settings; see the Common Variables section for details