/    Sign up×
Community /Pin to ProfileBookmark

Popcorn – the flexible, fast, and simple template engine for PHP!

[SIZE=”5″][COLOR=”DarkOrange”]Popcron![/COLOR][/SIZE]

Hello ) I wrote this simple template engine for PHP! Popcorn!

Site: [url]http://popcorn.template-cms.org/[/url]

[b]Built-in popcorn template codes[/b]
{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

[b]Simple php application[/b]

[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’);

?>
[/code]

[b]Simple template[/b]

[code]
<html>
<head>
<title>Simple template</title>
</head>
<body>
{if $show}
{echo $variable}
{/if}
</body>
</html>
[/code]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@hastxMay 07.2011 — if you have classes available, you should post them on phpclasses.org. You will get great exposure and a better chance of contribution from other developers.
Copy linkTweet thisAlerts:
@AwilumauthorMay 07.2011 — [b]Snippets for [url=http://www.sublimetext.com/]Sublime Text[/url][/b]

@@ - {@ $var}

@echo - {echo $var}

@if - {if $var} {/if}

@ifelse - {if $var} {else} {/if}

@ifelseif - {if $var} {elseif $var} {/if}

@loop - {loop $key as $item} {/loop}

@var - {var name $var2}

@const - {const name $value}

@assign - {assign var $value}

@include - {include 'template_name'}

@file - {file 'filename'}

@run - {run function()}

@vars - {vars}

@codes - {codes}

@dump - {dump $var}

[B]Download:[/B] [url=http://popcorn.template-cms.org/files/st_snippets/popcorn.zip]popcorn.zip[/url]

[B]Install:[/B] Unpack the archive to a folder [B]Sublime TextPackagesUser[/B]
×

Success!

Help @Awilum spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...