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;
}
VariableUsed for
--textText
--mutedLess important text, such as term URIs, languages, references, the citation and the footer
--accentLinks, the edge of each term's box, buttons and focus outlines
--accent-darkLinks and buttons when hovered or focused
--borderLines and borders, such as table borders and the rule under the header
--panelBackgrounds of term boxes, code, the administration menu and the glossary's letter links
--error and --error-panelError messages and administration warnings, and their background
--success and --success-panelMessages 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.

TemplateShows
core.phpThe overall page layout: the head of each page, the header with the search box, the menu, the citation and the footer
home.phpThe home page, or the search results when there is a search
cv.phpA controlled vocabulary's page, and the list of vocabularies
term.phpThe page of a term that is not in a controlled vocabulary
search.phpThe search results
not-found.phpThe page for an address where there is no term
term-list.phpEvery 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.