作者:200433 | 来源:互联网 | 2023-05-19 15:24
smarty的设置<?php;********[database]hostname localhostusername &nbs
smarty的设置
index.htm
{{foreach from = $rs item = item}}
{{$item.name}}: |
{{$item.content}} |
{{/foreach}}
一共有{{$pages}}页
{{$total}}条数据
每页显示{{$rows}}条
上翻
{{foreach from = $links item = num}}
{{if $num == $current_page}}
{{$num}}
{{else}}
{{$num}}
{{/if}}
{{/foreach}}
下翻
|
下面是显示程序
fetch_one(&#39;select count(*) as num from test&#39;);
$page_arr = $mdb->page($num[&#39;num&#39;], $page, 7, 4);
$rs = $mdb->fetch_all(&#39;select * from test order by id desc limit &#39; . $page_arr[&#39;start&#39;] . &#39;,&#39; . $page_arr[&#39;rows&#39;]);
$html->assign(&#39;rs&#39;, $rs);
$html->assign(&#39;web_path&#39;, $html->config[&#39;web_path&#39;] . &#39;/&#39;);
$html->assign($page_arr);
$html->render(&#39;index.htm&#39;, &#39;/test_&#39; . $page_arr[&#39;current_page&#39;] . &#39;.html&#39;);
?>
下面是保存留言代码
add(&#39;test&#39;, array(&#39;name&#39;, &#39;content&#39;), array($_POST[&#39;username&#39;], $_POST[&#39;content&#39;]));
header(&#39;location:test.php&#39;);
?>
CREATE TABLE `test` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`content` tinytext NOT NULL,
PRIMARY KEY (`id`)
)
转载随意!带上文章地址吧。