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(string|array $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 from the router:

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

Article

Display the articles:

<?php echo Tag::article(int $categoryId, array $optionArray); ?>

Comment

Display the comments:

<?php echo Tag::comment(int $articleId, array $optionArray); ?>

Extra

Display the extras:

<?php echo Tag::extra(int $extraId, array $optionArray); ?>

Pagination

Display the pagination:

<?php echo Tag::pagination(string $type, int $parentId, array $optionArray); ?>

Navigation

Display the navigation:

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

Comment form

Display the comment form:

<?php echo Tag::commentForm(int $articleId); ?>

Search form

Display the search form:

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

Template Helpers

Get registry

Get item from the registry:

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

Get language

Get item from the language:

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

Get setting

Get item from the settings:

<?php Helper::getSetting(string $key); ?>

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 CSS class helpers:

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

Get response code

Get the HTTP response code:

<?php Helper::getResponseCode(); ?>
Edit on GitHub