PHP Template

Skor PHP Template

Skor php template is a set of classes featuring a basic class with simple placeholders and a second class with "sections" extending the template class. The section class will allow you nesting and repetetive use of code. Skor PHP Template is fully compatible with PHP 8.1.

Join the project

at Gitlab.com

Download template php class

as tar.gz

Git

Create clone

$ git clone https://gitlab.com/internetagentur-sebastiany.net/php-template.git

or via ssh

$ git clone git@gitlab.com:internetagentur-sebastiany.net/php-template.git

Skor PHP Template howto

include and instantiate the class section of the template system
require_once('./src/class_template.php');
require_once('./src/class_section.php');
$template = new section();
if set to 'true' you will see placeholders without values after display
$template->keep_unassigned = false;
Read one or more template files
$template->read('./templates/head.html');
$template->read('./templates/main.html');
simply fetch the content of a section for further processing
$head = $template->fetch('Head');
or prepare to display it
$template->assign_section('Head');
This is how you assign a placeholder
$template->assign('LINKTEXT','sebastiany.net');
$template->assign_section('Body');