Template function/class slows down site a lot, especially if it is implemented in PHP. This is an example code how output bufferring and include() can be used as template.
Download
View Source (print view)
Rating : 4.7
Views : 256
<?php
// FILE: simple_template.php
// This file uses temple.tpl
//
// If you need to deal with array and do not want to use
// array syntax in template, then use extract().
// http://www.php.net/manual/en/function.extract.php
// With extract(), you should need minimum PHP code in
// template files when you have loop in template.
// (If PHP supports macro, it would be almost the same as
// other template systems. Macro is not supported
// currently.)
//
// Once you understand how output buffer and include could
// be used, you should be able to separate code and html
// just like other template systems.
//
// I don't use any template function/class. Let me
// know if you think you need template function/class.
//
// yohgaki@hotmail.com
//
/*
Note: To include template.tpl correctly, you need
to enable ASP style tag in php.ini.
I use <%= %> syntax, since <?php= ?> is not
supported. (<?= ?> syntax has problem with XML)
<%=$var%> is equivalent to <% echo $var %>
*/
$title = 'Template Test';
$msg1 = 'Test message 1';
$msg2 = 'Test message 2';
ob_start();
include('template.tpl');
$html = ob_get_contents();
ob_end_clean();
print $html;
?>
// FILE: template.tpl
// Save following file as template.tpl
// This file is used by simple_template.php
<head>
<title><%=$title%></title>
</head>
<body>
$msg1 = <%=$msg1%><br>
$msg2 = <%=$msg2%><br>
</body>
</html>
php file upload, shopping_cart and user=0--, drop down, mysql_commit, forum, shopping_cart', backup, updateoraddimagesonpages, rtttl to 8 bit source code, stefan_hornea, rent_and_0=1_union_select, how to run php, php_script"_class="neww"_target="_blank"_title="im_neuen, embed_snippets, farah_aead, sql incection, antoine anik, i need webmail login name and password, trailing_slashes, php keywords and 0 and 0=1 union select =1 union select, php script" class="neww" target="_blank" title="im neuen fenster