Skip to content

Templates

GrumpyCrouton edited this page Aug 7, 2022 · 4 revisions

Creating a Template

Building a template is as easy as writing HTML markup, because that is all you have to do.

All you truly need, is one line of code.

<include href="{{ @content }}" />

This line of code will contain the rendered view of whatever your module is trying to load.

Utilizing a Template

A template is a very powerful tool because of what it allows you to do. It has access to a ton of PHP variables, which you can access in unobtrusive custom HTML syntax. Check out the Variables section of the Views wiki to see other ways you can interact with data.

Here are some common variables available in the template. This list is not exhaustive. You can access any variable set by F3's set() method.

Variable Description
@BASE Gets the base URL to your site. Useful for linking resources. E.G <link href="{{ @BASE }}/assets/css/custom.css">
@module Tells you which module the user currently has loaded. Useful for controlling active classes on menu bars and such
@content Rendered HTML content from loaded module
@SESSION Allows you to access session data. Used as an array.
Clone this wiki locally