Popcron!
Hello ) I wrote this simple template engine for PHP! Popcorn!
Site: http://popcorn.template-cms.org/
Built-in popcorn template codes
{echo $var} - Output variable
{var name $var2} - Assign local template variable
{const name $value} - Assign constant
{file 'filename'} - Load file
{run function()} - Run php function
{if expr} {else} {elseif expr} {/if}- If construct
{loop $mas as $item}{/loop}
{loop $mas as $key => $item}{/loop} - Loop construct
{codes} - Show all declared template codes
{vars} - Show all declared variables
{dump $var} - Dumps information about a variable
{assign var 'value'} or {assign var $value} - Assign global variable
{include 'template_name'} - Include other template
Simple php application
Code:<?php // Include Popcorn include 'popcorn/popcorn.class.php'; // Initialize a Popcorn object $popcorn = new Popcorn(); // Variable assign $variable = 'Hello World!'; $popcorn->assign('variable',$variable); $popcorn->assign('show',true); // Draw the template $popcorn->draw('page'); ?>
Simple template
Code:<html> <head> <title>Simple template</title> </head> <body> {if $show} {echo $variable} {/if} </body> </html>


Reply With Quote
Bookmarks