Stitch 让你将 PHP 模板和页面分开不同的文件保存,然后动态的缝合在一起生成页面。
示例代码:
Template.php
<?php include('stitch.php'); ?><!DOCTYPE html><html> <head> </head> <body> <div style="background-color:#f0f0f0;"> <?php defineblock('main-content'); ?> </div> </body></html>
HomePage.php
<?php include('Template.php'); ?><?php startblock('main-content') ?> Here is my home page's main body content.<?php endblock() ?>