GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - arkphp/template: Native PHP template engine

BranchesTags
Open more actions menu

Latest commit

 

History

9 Commits
9 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 
phpunit.xml
phpunit.xml
 
 

Repository files navigation

PHP Template Build Status

Native PHP template engine

Installation

composer require ark/template

Usage

use Ark\Template\Engine;

$template = new Engine('/path/to/templates/root');

$template->render('index.php', [
    'username' => 'hello'
]);

layout.php:

<!DOCTYPE html>
<html>
<head>
    <title><?php $this->block('title');?></title>
</head>
<body>
    <?php $this->block('header');?>
    <?php $this->begin('content');?><?php $this->end();?>
    <?php $this->block('footer');?>
</body>
</html>

index.php:

<?php $this->extend('layout.php');?>
<?php $this->begin('title');?>Page Title<?php $this->end();?>
<?php $this->begin('content');?>
Page Content
<?php $this->end();?>

<?php $this->begin('footer');?>
Custom footer
<?php $this->end();?>

Markups

Declare layout:

<?php $this->extend('layout.php');?>

Declare a block:

<!-- empty block -->
<?php $this->block('blockname');?>

<!-- block with content -->
<?php $this->begin('blockname');?>
Block content
<?php $this->end();?>

Include another template:

<?php $this->render('another.php');?>

Template Functions

Escaping:

<?=$this->escape($username)?>
<!-- or for short -->
<?=$this->e($username)?>

Filter:

<?=$this->filter($username, 'strtolower|trim')?>
<?=$this->e($username, 'strtolower|trim');?>

About

Native PHP template engine

Topics

phptemplate-engine

Resources

Readme
MIT license
Activity
Custom properties

Stars

9 stars

Watchers

2 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.