/ Published in: PHP
Based on Jdub7's Pure PHP Template function
http://snipplr.com/view/10797/pure-php-template-function/
http://snipplr.com/view/10797/pure-php-template-function/
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php foreach ($vars as $key => $var) { } return $template; } 'title' => 'Hello World!', 'text' => 'Hello!', 'link' => 'http://www.bigsmoke.us/php-templates/functions' ); $html = apply_template("_main.tpl",$template_vars); echo $html; #_main.tpl # # #<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" # "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> #<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" dir="ltr"> #<head> # <meta http-equiv="content-type" content="text/html; charset=utf-8" /> # <title>[+title+]</title> # #</head> #<body> # <h1>[+title+]</h1> # <p>[+text+]</p> # <a href="[+link+]">[+link+]</a> #</body> #</html> ?>