Template Basics

Templates are located inside the templates directory. You can set a global template under admin/edit/settings and customize a template for each content.

Hidden feature

Override the current settings by temporary switching between installed templates:

domain.com/article.{template-name}
domain.com/?p=article&t={template-name}
Edit on GitHub

Template Partials

Index

Required file index.phtml contains your basic layout.

<!DOCTYPE html>
<html>

	<!-- head -->

	<head> ... </head>

	<!-- body -->

	<body>
	
		<!-- header -->
		
		<!-- main -->
		
		<!-- footer -->
		
		<!-- script -->
	
	</body>

</html>

Head

File head.phtml contains <base>, <title>, <meta>, <link> and <script> elements for your <head> tag.

<!-- base -->

<base />

<!-- title -->

<title> ... </title>

<!-- meta -->

<meta />

<!-- link -->

<link />

<!-- head script -->

<script> ... </script>

Header

File header.phtml contains elements for your structural <header> tag.

<!-- header -->

<header> ... </header>

Main

File main.phtml contains elements for your structural <main> tag.

<!-- main -->

<main>

	<!-- error -->

	<!-- content -->

	<!-- sidebar -->

</main>

Error

File error.phtml contains error related elements for your structural <article> tag.

<!-- error -->

<article> ... </article>

Content

File content.phtml contains content related elements for your structural <article> tag.

<!-- content -->

<article> ... </article>

Sidebar

File sidebar.phtml contains elements for your structural <aside> tag.

<!-- sidebar -->

<aside> ... </aside>

Footer

File footer.phtml contains elements for your structural <footer> tag.

<!-- footer -->

<footer> ... </footer>

Script

File script.phtml contains <script> elements before the body tag.

<!-- foot script -->

<script> ... </script>
Edit on GitHub

Template Tags

Namespace

Define the template namespace at the top:

<?php namespace Redaxscript\Template; ?>

Partial

Include a single or multiple PHTML partials:

<?php echo Tag::partial(mixed $file); ?>

Base

Create a <base> tag inside your <head> tag:

<?php echo Tag::base(); ?>

Title

Create a <title> tag inside your <head> tag:

<?php echo Tag::title(string $text); ?>

Meta

Create a <meta> tag inside your <head> tag:

<?php echo Tag::meta(); ?>

Link

Create a <link> tag inside your <head> tag:

<?php echo Tag::link(); ?>

Style

Create a <style> tag inside your <head> tag:

<?php echo Tag::style(); ?>

Script

Create a <script> tag inside your <head> tag:

<?php echo Tag::script(); ?>

Breadcrumb

Display the breadcrumb:

<?php echo Tag::breadcrumb(); ?>

Content

Display the contents:

<?php echo Tag::content(); ?>

Extra

Display the extras:

<?php echo Tag::extra(string $filter); ?>

Navigation

Display the navigation:

<?php echo Tag::navigation(string $type, array $options); ?>

Search form

Display the search form:

<?php echo Tag::searchForm(string $table); ?>

Get registry

Get item from the registry:

<?php Tag::getRegistry(string $key); ?>

Get language

Get item from the language:

<?php Tag::getLanguage(string $key, string $index); ?>

Get setting

Get item from the settings:

<?php Tag::getSetting(string $key); ?>
Edit on GitHub

Template Helpers

Get title

Get the value for the title:

<?php Helper::getTitle(); ?>

Get canonical

Get the value for the canonical URL:

<?php Helper::getCanonical(); ?>

Get description

Get the value for the meta description:

<?php Helper::getDescription(); ?>

Get keywords

Get the value for the meta keywords:

<?php Helper::getKeywords(); ?>

Get robots

Get the value for the meta robots:

<?php Helper::getRobots(); ?>

Get transport

Get the PHP to JavaScript transport:

<?php Helper::getTransport(); ?>

Get subset

Get the language related subset:

<?php Helper::getSubset(); ?>

Get direction

Get the language related direction:

<?php Helper::getDirection(); ?>

Get class

Get the client related CSS classes:

<?php Helper::getClass(string $prefix); ?>
Edit on GitHub