复制内容到剪贴板
代码:
<?php
require_once('phplib/php/template.inc');
require_once('phplib/php/db_mysql.inc');
$t =& new Template('template');
$t->set_file(array('main'=>'index.html','header'=>'header.html','footer'=>'footer.html'));
$db =& new DB_MySQL;
$db->connect("test","localhost","root","");
$db->query('set names utf8');
$t->set_block('main','list','nlist'); //模板中的块
$db->query("SELECT title FROM document");
while($db->next_record())
{
$t->set_var(array('title'=>$db->f('title')));
$t->parse('nlist', 'list', true);
}
$db->free();
$t->set_var(array('man'=>'korpotn', 'author'=>'panloon'));
$t->set_var("WEBSITE","站点的名称");
$t->pparse("OUT",array("t"=>"header","h"=>"footer","main"))
?>复制内容到剪贴板
代码:
--
-- 数据库: `test`
--
-- --------------------------------------------------------
--
-- 表的结构 `document`
--
CREATE TABLE `document` (
`id` int(10) unsigned NOT NULL auto_increment,
`title` varchar(255) NOT NULL default '(no title)',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
--
-- 导出表中的数据 `document`
--
INSERT INTO `document` (`id`, `title`) VALUES (1, 'phplib title test'),
(2, 'phplib 中文测试');============================================================================================
附中这上面的这个例子:
想问一下问题:你们有没有谁知道有能够与dreamware的模板功能相配合运作的php template? smarty下我见过使用插件实现的!我想要一个轻量级的,不要那么大的功能,哈哈!