The BruisedFruit template system is as unobtrusive as possible. We understand that people don't want to have to learn a new proprietary format for each and every product they use. As such, the BruisedFruit template system works by parsing standard PHP files looking for a series of predefined tags.
If you are new to BruisedFruit templates, the easiest thing to do here is to copy the existing, standard template.
- In your favourite FTP program, navigate to the tmp directory, which is where all BruisedFruit templates are stored.
- Inside tmp you'll find a folder called standard. Download it to your local machine.
- Rename your local copy from standard to a name that best suits your template (for example: apple).
- Upload your new template folder.
Now that you have uploaded your new template folder, it's time to edit your BruisedFruit configuration file to make your wiki use it.
- In your root BruisedFruit directory, find and download the file config.php
- Open it in your favourite text editor and find the line:
define('BF_TMP_DIR', 'standard'); - Change 'standard' to your new template folders name.
- Save config.php and reupload it.
Voila! Your BruisedFruit wiki is now using a custom template!
Of course, your new template looks
exactly like the standard BruisedFruit template, so you won't notice the slightest difference. Before you start hacking away, making changes left, right and centre, there are a few important things that you must keep in mind while working on a BruisedFruit template:
- There are three absolutely essential BruisedFruit template files. These are:
search.php, view.php and edit.php. While it's possible to delete everything else in the template folder, BruisedFruit calls these files directly. - BruisedFruit templates are parsed as PHP files, meaning any PHP code you wish to include can and will be executed when the template is parsed. This means it's perfectly acceptable to use include's to encapsulate a template page with a generic header and footer (the standard BruisedFruit theme actually does this).
Here's a breakdown of BruisedFruit template tags and how and where you should use them:
There are some BruisedFruit template tags that will work regardless of which page they are placed in. These are:
-
{BF_TMP_DIR} - points to the current template directory (i.e: tmp/apple) -
{BF_SITE_NAME} - the name of the site (as established in config.php) -
{BF_SITE_URL} - the base BruisedFruit site URL (again, as establish in config.php) -
{BF_PAGE_NAME} - outputs the name of the current page
These tags are specific to
view.php:
- Last modified by:
-
{BF_LAST_MODIFIED_NAME} - the name of the user who last modified this particular article -
{BF_LAST_MODIFIED_DATE} - the date this particular article was last modified
The article timeline is responsible for generating a list of users who have previously modified the article that is being viewed:
-
{BF_ARTICLE_TIMELINE}{/BF_ARTICLE_TIMELINE} - contains the article timeline tags. If the article hasn't been previously edited, these tags (and anything contained within them) will be hidden. If you don't want your template to show an article timeline, simply remove anything between these tags. -
{BF_ARTICLE_TIMELINE_ROW}{/BF_ARTICLE_TIMELINE_ROW - anything contained within these tags will be repeated for each instance on the timeline. -
{BF_ARTICLE_TIMELINE_SEPARATOR}{/BF_ARTICLE_TIMELINE_SEPARATOR} - anything between these tags will be placed between each timeline instance. For example: {BF_ARTICLE_TIMELINE_SEPARATOR}{/BF_ARTICLE_TIMELINE_SEPARATOR} would result in something like instance, instance. -
{BF_ARTICLE_TIMELINE_CONTRIBUTOR} - displays the name of the contributor. -
{BF_ARTICLE_TIMELINE_URL} - outputs the url to that particular edition of the article -
{BF_ARTICLE_TIMELINE_DATE} - outputs the date of that particular edition (the date format can be specified in config.php and should correspond with PHP's date function formatting). -
{BF_ARTICLE} - outputs that pages' article.
These tags are specific to
search.php:
-
{BF_SEARCH_PHRASE} - the submitted search phrase. -
{BF_SEARCH_RESULTS}{/BF_SEARCH_RESULTS} - contains the submitted search results. If no results are found, these tags (and anything contained within them) will be hidden. -
{BF_SEARCH_ROW}{/BF_SEARCH_ROW} - anything contained within these tags will be repeated for each search result. -
{BF_SEARCH_ARTICLE_URL} - outputs the address of a particular article result. -
{BF_SEARCH_ARTICLE_NAME} - outputs the name of a particular article result. -
{BF_SEARCH_ARTICLE_RELEVANCE} - outputs the relevance of a particular article result (in percentage format). -
{BF_SEARCH_ARTICLE_SIZE} - outputs the size (in bytes) of a particular article result.
These tags are specific to
search.php:
-
{BF_EDIT_ACTION} - the form action for a particular search. -
{BF_ARTICLE} - outputs the article to be edited.