企业站列表页

<?php
$typename="news";
$url="news.php";
$id=$_REQUEST["id"];
$cid=$_REQUEST["cid"];
if($id==''||!isset($id)){$id='';}else{$id=(int)$id;}
if($cid==''||!isset($cid)){$cid=4;}else{$cid=(int)$cid;}
 if($id=='' and $cid==''){echo "<script>window.location.href='error.html';</script>";exit;}
require("top.php");
?>


新闻类别输出
<?php  $query=$conn->query("select classId,className from newsclass where parentId={$leftId} order by classOrder desc");
while($row=$conn->fetch_row($query)){
?>
  <li class="b_class"><a href="<?=$url?>?id=<?=$row[0]?>"<?php if($row[0]==$cid or $row[0]==$id){echo "style='color:#f00;'";} ?>><?=$row[1]?></a></li>
 <?php } ?>


您的当前位置 > <a href="index.php">首页</a> > <?=$title?>


<?php
//分页:
//$cid=3;
$pagestr='?id='.$id;
$search=$_REQUEST["search"];
 if(!is_null($search)){
  $search=str_replace(array('\\','%','&','"',"'"),'',$search);
  $sql_add=" and title like '%".$search."%'";
  $pagestr.='&search='.$search;}
else
  $sql_add="";
$sql="select id,title,addDate,hits from news where classId in (".getchildClassIds($id).") ".$sql_add." order by newsOrder,id desc";
$pageSize = 10;
$query = $conn->query($sql);
$recordSum = $conn->num_rows($query);
$pageSum = ceil($recordSum/$pageSize);
if(isset($_REQUEST['page'])&&intval($_REQUEST['page'])&&((int)$_REQUEST['page'] <= $pageSum))
   $page = $_REQUEST['page'];
else
   $page = 1;    
//$page_str = showPage($page,$pageSum,$recordSum,$pagestr,'center');
$page_str = wlwshowPage($page,$pageSum,$recordSum,$pagestr,'center');
$startRecord = ($page-1)*$pageSize;
$sql = $sql." limit {$startRecord},{$pageSize} ";
$query = $conn->query($sql);
if($recordSum <= 0){
    echo '<li>没有相关数据</li>';
    $page_str="";
}else{
    while($row = $conn->fetch_row($query))
{?>    


<li><span><?=date("Y-m-d",strtotime($row[2]))?></span><a href="newsinfo.php?id=<?=$row[0]?>"><?=$row[1]?></a></li>


    <?php }}$conn->free_result($query);?>


分页:<div class="pager"><?=$page_str?> </div>

你可能感兴趣的:(列表页,企业站)