Skip to main content

Organising content

Tags and collections

Related content can be grouped using tags (TfishTag) and collections (TfishCollection), both of which are content types in their own right.

Tags are essentially "subject labels" that you can apply to other content objects; you can label a content object with as many tags as you want. Associations between tags and content are recorded as taglinks (TfishTaglink) in the taglink table of the database. Every time a content object is inserted, updated or deleted its associated taglinks must also be updated.

Collections function roughly as categories; you can assign content item to any existing collection using the 'parent' field in the content data entry form. Any type of content can be assigned to a collection, so mixed sets are possible. Collections can be nested by assigning one as the parent of another, thereby creating subcategories. Tags can also be organised into collections, which is useful if you want to create custom tag select boxes from a subset of tags.

Creating sections on your website

Both tags and collections can be used to quickly create sections (logical divisions of content) for a website. For example you may wish to organise content by type (articles) or by subject (tags), that you might include as menu or navigation element.

If you wanted to create a "Publications" section on your website, you could create a collection object called "Publications" and assign it as the parent of your publication objects (for example, PDF downloads). Both tags and collections display a list of related / child content below their own description, in teaser format. Add a link to the ID of the "Publications" collection in your navigation menu (remember it's as simple as https://yoursite.com?id=42) and you have an instant site section that will automatically update itself as you add relevant content. Tags work the same way.

If you would prefer a user-friendly URL like https://yoursite.com/publications.php, that can be achieved by making a copy of /extras/staticpage.php with whatever filename you prefer (in this case, 'publications.php'), and editing the tag or collection ID into the configuration section at the top of the script. Put it in your site root and you are done.

////////// CONFIGURATION //////////
// 1. Enter the ID of the content object you want to display on this page.
$id = 10;

// 2. Enter the name of the page you want headings and tags to link back to, without extension.
$target_file_name = 'publications';

// 3. Set the page title.
$tfish_template->page_title = 'Publications';
////////// END CONFIGURATION //////////

Copyright, all rights reserved.

Related

Tuskfish CMS Developer Guide

This guide will give you an overview of the architecture of Tuskfish CMS, how to write code to perform common operations and how to extend the system to suit yourself. The guide accompanies theĀ Tuskfish API documentation. Keep a copy handy as you read this guide. It is best to review links to the API where provided, as not every detail will be discussed in the text. This is the first version of the guide, so it is still a work in progress.