代码拉取完成,页面将自动刷新
<?php
include 'common.php';
//查询分类信息,用于显示主导航栏
$sql = "select * from ".PRE."category where `display`='1' limit 10";
$result = mysql_query($sql);
while($row = mysql_fetch_assoc($result)){
$catelist[] = $row;
}
//接收一个ID用于匹配点击的是哪个,用于设置导航栏默认选中项
$click = $_GET['cid'];
//查询推荐信息
$sql = "select cate_id,style from ".PRE."homepage where recommend='1' limit 1";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$showcate = $row['cate_id'];
mysql_free_result($result);
//取出推荐的子分类名
$sql = "select id,name from ".PRE."category where pid in (select pid from ".PRE."category where id='{$showcate}')";
$result = mysql_query($sql);
while($row = mysql_fetch_assoc($result)){
$littlenav[] = $row;
}
//获取完整的url信息
if(!empty($_SERVER['QUERY_STRING'])){
$url = DOMAIN.$_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING'];
}else{
$url = DOMAIN.$_SERVER['SCRIPT_NAME'];
}
//创建session信息,用于登陆页面登陆后,返回来源页面
$_SESSION['source'] = $url;
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Head</title>
<link rel="stylesheet" type="text/css" href="<?php echo APP?>/css/style.css">
</head>
<body>
<div id="header" class="w">
<div class="logo fl">
<a href="<?php echo APP?>/index.php"><img src="<?php echo APP?>/images/logo.jpg" alt="" /></a>
</div>
<div class="right fr">
<ul class="fr fontyh">
<li><span><?php echo $_SESSION['home']['name']?> 欢迎光临梦芭莎!</span></li>
<?php $i = $_SESSION['home']['class'] == null? 2: $_SESSION['home']['class']; if($i < 2) echo '<li><a href="'.APP.'/admin/index.php">管理中心</a></li>
<li>|</li>'?>
<?php if(empty($_SESSION['home'])):?>
<li><a href="<?php echo APP?>/login.php">登陆</a></li>
<li>|</li>
<li><a href="<?php echo APP?>/register.php">注册</a></li>
<?php else:?>
<li><a href="<?php echo APP?>/logout.php">退出</a></li>
<?php endif;?>
<li>|</li>
<li><a href="<?php echo APP?>/usercenter/index.php">个人中心</a></li>
<div class="clear"></div>
</ul>
<div class="clear"></div>
<div class="r_bottom">
<div class="searcharea fl">
<div class="search">
<form action="<?php echo APP?>/secondary.php" method="get">
<input type="hidden" value="0" name="cid">
<div class="search_con">
<input type="text" name="keyword" />
</div>
<div class="submit">
<input type="submit" value="" />
</div>
<div class="clear"></div>
</form>
</div>
<div class="submenu">
<ul>
<?php if(!empty($littlenav)): foreach($littlenav as $val):?>
<li><a href="<?php echo APP ?>/secondary.php?cid=<?php echo $val['id'] ?>" ><?php echo $val['name']?></a></li>
<?php endforeach;endif;?>
<div class="clear"></div>
</ul>
</div>
</div>
<div class="shopcar fr">
<div class="che fr fontyh">
<a class="fl" href="<?php echo APP?>/shoppingcar.php">
<img class="fl" src="<?php echo APP?>/images/che.jpg" alt="" />
<div class="num fl"><?php echo count($_SESSION['cart'])?></div>
<span class="fl">购物车 ></span>
</a>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
</div>
<div class="clear"></div>
</div>
<div id="main_menu">
<ul class="w fontyh">
<li><img src="<?php echo APP?>/images/fl.jpg" alt="" /></li>
<li><a <?php if($click == null) echo 'class="checked"'?> href="<?php echo APP ?>/index.php">首页</a></li>
<?php foreach($catelist as $val):?>
<li><a <?php if($click == $val['id']) echo 'class="checked"'; ?>href="<?php echo APP ?>/secondary.php?cid=<?php echo $val['id']?>"><?php echo $val['name']?></a></li>
<?php endforeach;?>
<div class="clear"></div>
</ul>
</div>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。