<?php
defined('IN_TS') or die('Access Denied.');
//通过appname获取当前分类，不存在则404错误

	$strcate = $db->once_fetch_assoc("select * from ".dbprefix."goods_cate where appname = '".$cate_appname."' and parent_id=0");
	$cateid = intval($strcate['cate_id']);
	
	
	$all_huabao = $db->fetch_all_assoc("select * from ".dbprefix."p_str where cateid =".$cateid." and is_im=0");
	
	$p = _post('p');
	$spage  = ($p-1)*15;
if(count($all_huabao)>$spage){
$huabao_arrs = $db->fetch_all_assoc("select * from ".dbprefix."p_str where cateid =".$cateid." and is_im=0 order by pictorialId desc limit $spage,15");
	
	if(is_array($huabao_arrs)){
	foreach($huabao_arrs as $key=>$item){
		
		$p_id_arr = explode('_',$item['p_str']);
		
		$huabao_arrs[$key]['f_pictorial'] = $db->once_fetch_assoc("select * from ".dbprefix."pictorial where id =".$p_id_arr[0]);
		
		if(count($p_id_arr)>4){
			array_shift($p_id_arr);
		}
		$pictorial_img = '';
		foreach($p_id_arr as $kkey=>$iitem){
			
			if($kkey<4){
				$pictorial = $db->once_fetch_assoc("select * from ".dbprefix."pictorial where id =".$iitem);
				$pictorial_img[] = $pictorial['photo'].'_200x300.jpg';
			}
		}
		$huabao_arrs[$key]['thumb-img'] = $pictorial_img;
		
}
	foreach($huabao_arrs as $key=>$item){
		
		 foreach($item['thumb-img'] as $kkey=>$iitem){
			
			$last = $kkey==3?'last-img':'';
		$thumb= '<div class="thumb-img '.$last.'">
                <img src="'.SITE_URL.$iitem.'" alt="'.$item['title'].'配图" />
            </div>';
			
		}
		
		$str .='<div class="pict">
    <div class="cover clearfix">
        <a href="'.SITE_URL.tsurl('baobei',$item['pictorialId']).'" target="_blank">
            <div class="main-img">
                <img src="'.SITE_URL.$item['f_pictorial']['photo'].'_400x600.jpg" alt="斑马竖条纹 马上变潮妞封面图" />
            </div>
                      '.$thumb.'
                    </a>
    </div>
    <div class="text">
        <h3>
        '.$item['title'].'
        </h3>
        <p>
        '.$item['f_pictorial']['description'].'...
        </p>
    </div>
</div>
<input type="hidden" class="J_HiddenIsEnd" value="0"/>
';
}

		echo $str;


}}else{
	
	echo '<input type="hidden" class="J_HiddenIsEnd" value="1"/>';
	exit;
}

