Beispiel #1
0
function CommentList($shopID, $page)
{
    $i = 1;
    $pagesize = 6;
    $startRow = 0;
    $sqlStr = "select user_name,comment_id,comment_addtime,comment_content from qiyu_comment inner join qiyu_user on user_id=comment_user and comment_type='1' and comment_shop=" . $shopID;
    $rs = mysql_query($sqlStr) or die("查询失败,请检查SQL语句。");
    $rscount = mysql_num_rows($rs);
    if ($rscount % $pagesize == 0) {
        $pagecount = $rscount / $pagesize;
    } else {
        $pagecount = ceil($rscount / $pagesize);
    }
    if ($page < 1) {
        $page = 1;
    }
    if ($page > $pagecount) {
        $page = $pagecount;
    }
    $startRow = ($page - 1) * $pagesize;
    $sqlStr = "select user_name,comment_id,comment_addtime,comment_content,comment_addtime from qiyu_comment inner join qiyu_user on user_id=comment_user and comment_type='1' and comment_shop=" . $shopID . " order by comment_addtime desc,comment_id desc limit {$startRow},{$pagesize}";
    $rs = mysql_query($sqlStr);
    $count = mysql_num_rows($rs);
    while ($rows = mysql_fetch_assoc($rs)) {
        if ($i == 1) {
            $style = "style='margin-top:11px;'";
        } else {
            $style = '';
        }
        if ($i == $count) {
            $class = "class='commentList last'";
        } else {
            $class = "class='commentList'";
        }
        echo "<div " . $class . " " . $style . ">";
        echo "<p>" . $rows['user_name'] . "<span style='margin-left:8px;'>" . $rows['comment_addtime'] . "</span></p>";
        echo "<p>" . HTMLDecode($rows['comment_content']) . "</p>";
        echo "</div>";
        $i++;
    }
    echo "<input type=\"hidden\" id=\"shop_id\" value=\"" . $shopID . "\"/>";
    echo "<p class=\"h1 h1_r c_page\">评论数" . $rscount;
    if ($pagecount > 1) {
        echo "<span style=\"font-size:12px;\">";
        commentPage($page, $pagecount);
        echo "</span>";
    }
    echo "</p>";
}
Beispiel #2
0
									</div>
								<?php 
        $i++;
    }
    ?>
		
							<input type="hidden" id="shop_id" value="<?php 
    echo $shopID;
    ?>
"/>
							<p class="h1 h1_r c_page">评论数<?php 
    echo $rscount;
    if ($pagecount > 1) {
        ?>
<span style='font-size:12px;'><?php 
        commentPage($page, $pagecount);
        ?>
</span><?php 
    }
    ?>
</p>
							</div>
							<?php 
}
?>
						</div>
						<div id="s_left_bottom"></div>
					</div><!--left wan-->
					<div id="shop_right">
						<div id="right_top"></div>
						<div id="right_center">