代码拉取完成,页面将自动刷新
<form id="common-form" class="form-horizontal form-label-left" method="post" action="">
<input type="hidden" id="page-no" name="_page_no" value="1">
{notempty name='_search'}
{foreach $_search as $key => $field}
{switch name='field.type'}
{case value='text'}
<div style="display: inline-block;">
<label for="_{$key}">{$field.title}</label>
<input type="text" name="_query[{$key}]" value="{$_query_fields[$key]}" style="width: 140px;display: inline-block" id="_{$key}"
class="form-control">
</div>
{/case}
{case value='select'}
<div style="display: inline-block;">
<label for="_{$key}">{$field.title}</label>
<select name="_query[{$key}]">
<option value="_no_select_">全部</option>
{foreach $field['list'] as $ik=>$iv}
<?php
$selected="";
if(isset($_query_fields[$key])){
$selected = $ik==$_query_fields[$key]?'selected':'';
}
?>
<option value="{$ik}" {$selected} >{$iv}</option>
{/foreach}
</select>
</div>
{/case}
{/switch}
{/foreach}
<div style="display: inline-block;margin-left: 5px;">
<input type="submit" class="btn btn-primary" value="搜索"><a href="" class="btn btn-default">重置</a>
</div>
{/notempty}
</form>
<table class="table">
<thead>
{foreach $_headers as $header}
<th>{$header.title}</th>
{/foreach}
</thead>
<tbody>
{foreach $_rows as $row}
<tr>
{foreach $_headers as $key=>$header}
<td>{$row[$key]}</td>
{/foreach}
</tr>
{/foreach}
{empty name="_rows"}
<td align="center" colspan="{$_headers|count}">当前没有数据哦@_@~~</td>
{/empty}
</tbody>
<tfoot>
<tr>
<td colspan="{$_headers|count}">
<?php
//dump($_page);
?>
总数据:{$_page.total}
总页数:{$_page.count}
<div class="btn-group">
{if condition="$_page['no']-1>0"}
<button class="btn btn-default" type="button" onclick="jump_page('{$_page.no-1}')"><i class="glyphicon glyphicon-menu-left"></i></button>
{/if}
{if condition="$_page['count']>0"}
{for start="1" end="$_page['count']+1"}
{if condition="$_page['no']==$i"}
<button class="btn btn-default active" type="button">{$i}</button>
{else /}
<button class="btn btn-default" type="button" onclick="jump_page('{$i}')">{$i}</button>
{/if}
{/for}
{/if}
{if condition="$_page['no']+1<=$_page['count']"}
<button class="btn btn-default" type="button" onclick="jump_page('{$_page.no+1}')"><i class="glyphicon glyphicon-menu-right"></i></button>
{/if}
</div>
</td>
</tr>
</tfoot>
</table>
<script>
function jump_page(no) {
var form = document.getElementById('common-form');
var page_no = document.getElementById('page-no');
no = parseInt(no);
if(no<=0 && no > parseInt("{$_page.count}")){
console.log('该页不存在!');
return;
}
page_no.value = no;
form.submit();
}
</script>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。