21,886
社区成员
发帖
与我相关
我的任务
分享
<?php
include('../include/lib/Template.class.php');
require ('../include/init.inc.php');
function cc(){
try{
$dbh = new PDO('mysql:host=localhost;dbname=osadmin','root','root');
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$dbh->exec('set names utf8');
$stmt = $dbh->prepare('SELECT * FROM char_pie');
$stmt->execute();
$arr = array();
while($row = $stmt->fetch(PDO::FETCH_ASSOC))
{
$arr[]=$row ;
}
return $arr;
$dbh = null;
}catch(PDOException $e){
print"Error!:".$e->getMessage()."<br/>";
}
}
template::assign('ids',cc());
?>
html
<{include file ="header.tpl"}>
<{include file ="navibar.tpl"}>
<{include file ="sidebar.tpl"}>
<!--- START 以上内容不需更改,保证该TPL页内的标签匹配即可 --->
<{$osadmin_action_alert}>
<{$osadmin_quick_note}>
<div >
<input style="margin-left:95.8%;margin-top:10px;" type="submit" value="刷新" >
</div>
<div class="block">
<a href="#page-stats" class="block-heading" data-toggle="collapse">当前信息</a>
<div id="page-stats" class="block-body collapse in">
<table class="table table-striped">
<tr>
<td>编号</td>
<td>搜素引擎</td>
<td>点击次数</td>
</tr>
<{foreach $ids as $list}>
<tr>
<td ><{$list.id}></td>
<td ><{$list.title}></td>
<td ><{$list.pv}></td>
</tr>
<{/foreach}>
</table>
</div>
</div>
<script scr="../assets/lib/jquery-1.8.1.min.js"></script>
<script >
$('input').click(function(){
$.ajax({
url:'http://demo.osadmin.org:9096/uploads/ajax/refresh.php',
type:'get',
contentType:'application/x-www-form-urlencoded',
success:function(data){
$('#page-stats').html(data);
}
})
})
</script>
<!--- END 以下内容不需更改,请保证该TPL页内的标签匹配即可 --->
<{include file="footer.tpl"}>