Skip to content
Johan Janssens edited this page Mar 10, 2021 · 19 revisions

Joomlatools Pages has its own template engine designed to make complex things simple. It does most of the hard work for you when it comes to fetching, formatting, filtering, and displaying your content.

If you know even just a little PHP and HTML, you’ll understand the basics rather quickly.

Table of contents

Naming

A template file name defines both the format of the template as the rendering engine used to render and process it, for example, mypage.html, the html defines the format, and mypage.html.php, defines the php template engine to pre-process the template.

A template file without a rendering engine is a static template and is not pre-processed. Pages supports two types of rendering engines; the default PHP Engine and the Markdown engine.

Formats

Pages allows you to render a template in multiple formats. For example, /blog.html.php could be a HTML template with a listing of the posts, and /blog.rss.php the RSS feed of the posts.

Pages offers support for the following formats with their corresponding mime types:

  • html => text/html
  • txt => text/plain,
  • csv => text/csv,
  • js => application/javascript
  • css => text/css
  • json => application/json
  • xml => text/xml
  • rdf => application/rdf+xml
  • atom => application/atom+xml
  • rss => application/xml

See also: URLs and Linking > Pages

Engines

An optional second suffix defines the rendering engine that Pages should use to render the page. Out of the box Pages offers support for two rendering engines:

  • PHP Engine: mypage.html.php
  • Markdown: mypage.html.md

Without a rendering engine, the page content will be returned as is and will not be pre-processed.

Types

Page

A page is the fundamental building block of Joomlatools Pages and is a special type of template. This is where you write your content to be displayed in the frontend.

By default, pages files are loaded from the /pages directory. They have the ability to create URLs based on how they are arranged in your folder tree.

See also: Page

Layout

Layouts are templates that wrap around your content. They allow you to have the source code for your template in one place so you don’t have to repeat things like your navigation and footer on every page.

Layouts live in the /layouts directory. The convention is to have a base template called default.html and have other layouts inherit from this as needed.

See also: Templates > Layouts

Partial

Partials are generally small and reusable chunks of template code. You can build sections of a page and reuse them on different pages without the need to repeat yourself. In other words, partials help you keep your templates clean and DRY.

Partials can live anywhere but for the sake of consistency, it is best to place them in the '/partials' directory.

See also: Templates > Partials