Skip to content

CoLdAs1cE/php-template

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

php-template

Simple PHP template class.

Create template file

Example
Template variables:

  • {var} - single variable
  • {loop items} {name} {end loop} - loop for items array
  • {%index%} - index of item in items loop

Create index.php file

Example

  • Include template class:
    include 'template.php';
  • Create an object:
    $template = new Template();
  • Set template variables, single:
    $template->assign( 'my_var', 'test' );
  • Set template variables, loops:
    $template->assign( 'items', array( array( 'name' => 'First' ), array( 'name' => 'Second' ) ) );
  • Parse template:
    $template->parse( 'tpl.html' );

About

Simple PHP template class.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 98.0%
  • HTML 2.0%