gusucode.com > 同城苏州黄页系统php源码程序 > card.php

    <?
include_once( dirname(__FILE__)."/start.php" );

# 载入并初始化相关的网页类
if( !class_exists('dtl_card') )
	include_once("{$root_path}lib/class.webPge/dtl_card.class.php");
$me=&new dtl_card();

# 从数据库中 获得数据 并传递到 模板中。
if( !$me->get_db_data("`id`={$_REQUEST["id"]}") )
	exit("请求的网页并不存在。<script>location='/'</script>");

$me->title = $me->data['name'] ;							// 网页标题


# 添加 影响浏览页面的特殊代码
# …… ……


$me->data['topclassName'] = $_Classes[$me->data['topclass']]['name'] ;
$me->data['lowerclassName'] = $_Classes[$me->data['topclass']]['children'][$me->data['lowerclass']]['name'] ;

$me->fields['intro']->value = nl2br($me->fields['intro']->value) ;


// 相关图片
if( !$me->pics = $db->select('yp_picture',"`parent`={$_REQUEST['id']} and `is_open`='1' order by `id` desc") )
	$me->pics = array() ;

$scoretable = array(
	'-1' => '差',
	'1' => '一般',
	'2' => '好',
	'3' => '很好'
) ;
$scorecolortable = array(
	'-1' => '#FF0000',
	'1' => '#FFCC00',
	'2' => '#85B000',
	'3' => '#006600'
) ;


$onepage = 10 ;
if(!isset($_REQUEST['page']))
	$_REQUEST['page'] = 1 ;
	
$me->assign('commentBaseIdx',$onepage*($_REQUEST['page']-1)) ;

$total = $db->count('yp_comment',"`parent`={$_REQUEST['id']} and `is_open`='1'");
$start = $onepage * ($_REQUEST['page']-1);
if( $me->comments = $db->select('yp_comment',"`parent`={$_REQUEST['id']} and `is_open`='1' order by `id` desc limit $start,$onepage") )
{
	foreach ($me->comments as $idx=>$item)
	{
		$me->comments[$idx]['score'] = $scoretable[ $item['score'] ] ;
		$me->comments[$idx]['scorecolor'] = $scorecolortable[ $item['score'] ] ;
		$me->comments[$idx]['createTime'] = date('Y.n.d G:i:s', $item['createTime']) ;
		$me->comments[$idx]['text'] = nl2br($item['text']) ;
	}

	// 更新评论数量
	$cnt = $db->count('yp_comment',"`parent`={$_REQUEST['id']} and `is_open`='1'") ;
	if( $cnt != $me->data['CommentCnt'] )
		$db->update('yp_card', array('CommentCnt'=>$cnt),"`id`={$_REQUEST['id']} and `is_open`='1'") ;
}
else
	$me->comments = array() ;

include "lib/pageIdx.class.php" ;
$pb = new pageIdx($total, $onepage);
$CommentPageIdx   = $pb->whole_num_bar() ;
$me -> assign('CommentPageIdx',$CommentPageIdx) ;

	
//增加浏览量
$db->increase('yp_card','ViewCnt',"`id`={$_REQUEST['id']}") ;


$me->assign('noside',true);
$me->assign('content',"card.html");
include_once(dirname(__FILE__).'/before_display.php');
$me->display_webPge("main-frame.html");


if( @$_REQUEST['report'] )
{
	if( $db->update('yp_card',$_REQUEST['report'],"`id`={$_REQUEST['id']}") )
		echo "<script>alert('错误报告已经提交,谢谢您的支持!')</script>" ;
}


# 载入 尾文件
include_once(dirname(__FILE__).'/end.php');
?>