我们团队正在做一个项目遇到了一点瓶颈,特来向各位大神请教
<?php
header("Content-Type:text/html;charset=utf-8");
include('../../init.ini.php');
include('../../conet.php');
date_default_timezone_set("PRC");//设置时区为中国时区
session_start();//开启session
if(isset($_SESSION['ulogin']) || isset($_COOKIE['username']))//如果存在session的username或者从客户端发送来了Cookie
{
if(isset($_COOKIE['username']))
{
$username = $_COOKIE['username'];
$uimg = $_COOKIE['uimg'];
}
else{
$username = $_SESSION['uname'];
$uimg = $_SESSION['uimg'];
}
// $bid = $_GET['bid'];
$sql = "select * from books";
$result = mysql_query($sql);
// $content = array();
while($data = @mysql_fetch_assoc($result))//以关联数组的形式取出每一行数据
{
$content[] = $data;//将每一行的数据都存储到$content里面
}
$smarty -> assign("list",$content);//注册所有的数据
$smarty -> assign("content",$content);
$smarty -> assign("username",$username);//注册用户名
$smarty->assign("uimg",$uimg);
$smarty -> display("../../view/books/goodsinfo.tpl");//显示index模板文件
}
else{
header("Location:goodsinfo2.php");
}
//mysql_close($link);
?>
goodsinfo。tpl
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>商品信息</title>
<link rel="stylesheet" href="../../dist/css/bootstrap.min.css"/>
<script src="../../dist/js/jquery.min.js"></script>
<script src="../../dist/js/bootstrap.min.js"></script>
<script src="../../dist/js/holder.min.js"></script>
<script src="../../dist/js/application.js"></script>
<style>
.tb1{
height:31px;
line-height: 29px;
background-color: #ededed;
}
.tb2{
font-size: 12px;
line-height: 29px;
margin-left: 80px;
color: #8e8e8e;
font-weight: 70%;
font-family: "Microsoft Yahei",verdana;
}
#tb2 {
font-size: 12px;
line-height: 29px;
margin-left: 640px;
font-family: "Microsoft Yahei",verdana;
color: #8e8e8e;
}
#tb4{
font-size: 14px;
line-height: 29px;
font-family: "Microsoft Yahei",verdana;
margin-left: 10px;
color: #8e8e8e;
}
</style>
</head>
<body>
<div class="tb1">
<span class="tb2">欢迎来到木木书城!</span>
<{if isset($username)}>
<span id="tb2"><a href="../../content/books/personal.php" ><img src="<{$uimg}>" width="25px" height="25px" class="img-circle"><{$username}></a><a href="../../content/books/loginout.php">[退出]</a></span>
<{else}>
<span ><a href="login.php" id="tb3">免费注册</a></span>
<{/if}>
<span id="tb4" >
<span class="dropdown">
<span id="dLabel" role="button" data-toggle="dropdown">
<a href="shangpin.php">我的购物车</a>
</span>
</span>
</span>
</div>
<div style="border: 2px solid #dd3550;"></div>
<div class="container" style="background: #ececec;margin-top: 50px;width: 1170px;height: 500px;">
<div style="height:100px;font-size: 38px;margin-left: 470px;margin-top: 10px">木木书屋</div>
<div class="row" style="margin-left: 70px">
<{for $row=0 to count($list)-1}>
<div class="col-md-3">
<a href="#" class="thumbnail">
<img data-src="<{$list['img']}>" alt="..."/>
<{var_dump($list)}>
</a>
</div>
<div class="two" style="margin-left: 500px;margin-top: -300px">
<h3>作者:<{$list['bzuozhe']}></h3>
<h3>出版社:<{$list['chuban']}></h3>
<h3>出版时间:<{$list['bdate']}></h3>
<h3>定价:<{$list['bmoney']}></h3>
</div>
<{/for}>
</div>
<button type="button" class="btn btn-danger glyphicon glyphicon-shopping-cart" style="height: 40px;margin-left: 160px;margin-top: 35px"> <big><a href="shangpin.php">加入购物车</a></big></button>
<button type="button" class="btn btn-success" style="height: 40px;margin-left: 60px;margin-top: 35px"><big>立即购买</big></button>
<div style="border: 1px solid #c6c6c6;width: 500px;margin-left: 500px;margin-top: 60px"></div>
<p style="position: absolute;margin-left: 530px;margin-top: 20px">分享到: QQ空间 | 新浪微博 | 腾讯微博 | 人人网 | 微信 | 豆瓣网</p>
</div>
<div class="next" style="border: 1px solid #c0c0c0;width: 1170px;height:300px;margin-left:90px;margin-top: 23px">
<ul class="nav nav-tabs" style="background: #ececec;height: 40px">
<li class="active"><a href="#">用户评价 <span class="badge">0</span></a></li>
<div class="panel-group" id="accordion" style="margin-top: 45px">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-toggle="collapse" data-parent="#accordion"
href="#collapseOne">
用户头像:
</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
评论内容:Lorem ipsum dolor sit amet, consectetur adipisicing elit.
<p>
评论时间:Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-toggle="collapse" data-parent="#accordion"
href="#collapseTwo">
用户头像:
</a>
</h4>
</div>
<div id="collapseTwo" class="panel-collapse collapse">
<div class="panel-body">
评论内容:Lorem ipsum dolor sit amet, consectetur adipisicing elit.
<p>
评论时间:Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-toggle="collapse" data-parent="#accordion"
href="#collapseThree">
用户头像:
</a>
</h4>
</div>
<div id="collapseThree" class="panel-collapse collapse">
<div class="panel-body">
评论内容:Lorem ipsum dolor sit amet, consectetur adipisicing elit.
<p>
评论时间:Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>
</div>
</div>
</div>
</div>
<ul class="pagination" style="margin-left: 1002px;margin-top:11px">
<li ><a href="#">«</a></li>
<li ><a href="#">1 </a></li>
<li><a href="#">2 </a></li>
<li class="disabled"><a href="#">3 <span class="sr-only">(current)</span></a></li>
<li ><a href="#">»</a></li>
</ul>
</ul>
</div>
<div class="container" style="margin-top: 30px;">
<div style="border: 1px solid #b0b0b0;margin-top: 50px"></div>
<div style="margin-top: 20px;">
<p>@lovo 2017</p>
</div>
</div>
</body>
</html>