<table cellspacing="0" cellpadding="0"><tr><td class="t_f" id="postmessage_51365"> 很多时候,没有必要用到框架的静态网站,可以简单的用PHP来控制模板。<br>1.页面来处理自己用到视图部分。<br>2.框架模板来处理整体视图框架。<br>3.页面的内容模板,用来放到框架模板中。使用1里面的页面来调用。 <div class="blockcode"> <div id="code_vhy"><ol> <li> <li>//include our settings, connect to database etc.</li> <li>include dirname($_SERVER['DOCUMENT_ROOT']).'/cfg/settings.php';</li> <li>//getting required data</li> <li>$DATA=dbgetarr("SELECT * FROM links");</li> <li>$pagetitle = "Links to friend sites";</li> <li>//etc</li> <li>//and then call a template:</li> <li>$tpl = "links.tpl.php";</li> <li>include "template.php";</li> <li>?></li> </ol></div> <em onclick="copycode($('code_vhy'));">复制代码</em> </div> <div class="blockcode"> <div id="code_XDa"><ol> <li> <li> <li><title>My site. =$pagetitle?></title></li> <li> <li> <li><div id="page"> <li> include $tpl ?></li> <li> </div></li> <li> <li> </ol></div> <em onclick="copycode($('code_XDa'));">复制代码</em> </div> <div class="blockcode"> <div id="code_oyM"><ol> <li><h2>=$pagetitle?></h2></li> <li><ul> <li> foreach($DATA as $row): ?></li> <li> <li><a href="<?=%24row%5B'link'%5D?>" target="_blank">=$row['name']?></a></li> <li> endforeach ?></li> <li><ul></ul></li> </ul></li> </ol></div> <em onclick="copycode($('code_oyM'));">复制代码</em> </div> </td></tr></table> <div id="comment_51365" class="cm"> </div> <div id="post_rate_div_51365"></div> <br><br>