5 February 2018 | 39 views | Tags: Documentation
Site preferences are globally available via $tfish_preference, an instance of the TfishPreference class set in tfish_header.php, which is included in every page. To access a preference within a controller script you simply call:
If you want to output a preference to display and need to conduct XSS escaping, use:
Tuskfish preferences are edited via the Preferences link in the admin section of your site. The function of each preference is described in the User Manual.
Adding new preferences
You can add additional preferences to Tuskfish very simply. All you need to do is to:
- Add another row to the preference table of your database (use phpLiteAdmin or equivalent), with an appropriate data type and value.
- Add the new preference as a whitelisted property to the TfishPreference constructor, for example:
$this->__properties['some_preference'] = 'string'; // Or whatever data type is appropriate.
- You might - depending on the nature of your preference - need to set some explicit validation rules in the TfishPreference __set() method, to ensure that the preference cannot be misused.
- Add a row for your new preference to the form trust_path/libraries/tuskfish/form/preference_edit.html, so that you can edit it from the preference page.
- Add a language constant for your new preference to trust_path/libraries/tuskfish/language/english.php or equivalent.
Copyright, all rights reserved.
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.