Customising Ontomasticon
Ontomasticon is a simple, lightweight ontology and glossary server written in PHP and making use of MariaDB or MySQL.
Ontomasticon is simple to customise using a mixture of CSS and PHP templates, kept in the settings directory so that they stay in place when the code is updated.
CSS Theming
The default theme, css/default.css, gives every page a readable layout, and moves the menu under the header on narrow screens. To change it, copy settings/user.css.default to settings/user.css and make your changes there. Don't edit css/default.css itself, as updates replace it. settings/user.css is loaded after the default theme, so its rules take precedence.
The theme's colours are CSS variables, so a few lines can restyle the site:
:root {
--accent: #2e7d32;
--accent-dark: #1b5e20;
}
| Variable | Used for |
|---|---|
--text | Text |
--muted | Less important text, such as term URIs, languages, references, the citation and the footer |
--accent | Links, the edge of each term's box, buttons and focus outlines |
--accent-dark | Links and buttons when hovered or focused |
--border | Lines and borders, such as table borders and the rule under the header |
--panel | Backgrounds of term boxes, code, the administration menu and the glossary's letter links |
--error and --error-panel | Error messages and administration warnings, and their background |
--success and --success-panel | Messages saying something was saved, and their background |
Stylesheets and scripts are linked with the time they were last changed added to their address, so visitors' browsers fetch settings/user.css again after you change it.
PHP Templates
Various PHP templates are found in the templates folder. The supported method of user modification is to copy files you wish to change into the settings directory, where edits can be made and will remain in place during code updates. Ontomasticon uses a template in the settings directory instead of the one in the templates folder with the same name. A copied template doesn't get changes made to the original in later versions, so copy only the templates you need to change.
| Template | Shows |
|---|---|
| core.php | The overall page layout: the head of each page, the header with the search box, the menu, the citation and the footer |
| home.php | The home page, or the search results when there is a search |
| cv.php | A controlled vocabulary's page, and the list of vocabularies |
| term.php | The page of a term that is not in a controlled vocabulary |
| search.php | The search results |
| not-found.php | The page for an address where there is no term |
| term-list.php | Every list of terms: on the home page, vocabulary pages and search results, including the A to Z layout of a glossary |
Fragment templates may be used multiple times on a page, and/or on multiple pages. The term-fragment.php file is used to control how individual terms are displayed, and term-fragment-reference.php how a term's references are shown.