<div class="container">
	
	
    <div class="pg-opt pin">
        <div class="container">
            <h2><?php 
echo $name;
?>
</h2>
        </div>
    </div>
    
    <div class="container">
        <div>
             <?php 
$lists = sp_sql_posts_paged("cid:{$cat_id};order:post_date DESC;", 20);
?>
             <div id="container">
             	<div class="grid-sizer"></div>
             	<?php 
if (is_array($lists['posts'])) {
    $i = 0;
    $__LIST__ = $lists['posts'];
    if (count($__LIST__) == 0) {
        echo "";
    } else {
        foreach ($__LIST__ as $key => $vo) {
            $mod = $i % 2;
            ++$i;
            $smeta = json_decode($vo['smeta'], true);
            ?>
            &nbsp;<span><?php 
echo $nav_label;
?>
</span>
        </div>
    </div>
</div>
</div>
<?php 
$term_id = I('get.id', 1);
$childterm = sp_get_child_terms($term_id);
$cid1 = $childterm[0]['term_id'];
$cid2 = $childterm[1]['term_id'];
$lists1 = sp_sql_posts_paged("cid:{$cid1};order:listorder ASC,post_modified DESC;", 50, "{prev}{liststart}{list}{listend}{next}");
$lists1 = $lists1['posts'];
$lists2 = sp_sql_posts_paged("cid:{$cid2};order:listorder ASC,post_modified DESC;", 50, "{prev}{liststart}{list}{listend}{next}");
$lists2 = $lists2['posts'];
$list_c_1 = count($lists1);
$list_c_2 = count($lists2);
if ($list_c_1 > $list_c_2) {
    $fnum_1 = $list_c_1 - $list_c_2;
} else {
    if ($list_c_1 < $list_c_2) {
        $fnum_2 = $list_c_2 - $list_c_1;
    } else {
        $fnum_1 = 0;
        $fnum_2 = 0;
    }
}
?>
<section class="contentbox">
    }
}
?>
            &nbsp;<span><?php 
echo $nav_label;
?>
</span>
        </div>
    </div>
</div>
</div>
<?php 
$term_id = I('get.id', 1);
$childterm = sp_get_child_terms($term_id);
$type = isset($_GET['type']) ? $_GET['type'] : $_GET['id'];
$lists = $type == $_GET['id'] ? sp_sql_posts_paged_bycatid($_GET['id'], $tag, 12, "{prev}{liststart}{list}{listend}{next}") : sp_sql_posts_paged("cid:{$type};order:post_modified DESC;", 12, "{prev}{liststart}{list}{listend}{next}");
?>
<section class="contentbox">
	<div class="container">
    	<div class="conboxcon">
			<div class="conboxcon_1">
				<div class="lecturecont">
					<div class="recselcon">
						<ul class="res_sel">
							<li <?php 
if ($type == I('id')) {
    ?>
class="active"<?php 
}
?>
>
Exemplo n.º 4
0
/**
 * 功能:根据分类文章分类ID 获取该分类下所有文章(包含子分类中文章),已经分页,调用方式同sp_sql_posts_paged<br>
 * @author labulaka 2014-11-09 14:30:49
 * @param int $tid 文章分类ID.
 * @param string $tag 查询标签,以字符串方式传入,例:"field:post_title,post_content;limit:0,8;order:post_date desc,listorder desc;where:id>0;"<br>
 * 		field:调用post指定字段,如(id,post_title...) 默认全部<br>
 * 		limit:数据条数,默认值为10,可以指定从第几条开始,如3,8(表示共调用8条,从第3条开始)<br>
 * 		order:排序方式,如:post_date desc<br>
 *		where:查询条件,字符串形式,和sql语句一样
 * @param int $pagesize 每页条数.
 * @param string $pagetpl 以字符串方式传入,例:"{first}{prev}{liststart}{list}{listend}{next}{last}"
 */
function sp_sql_posts_paged_bycatid($cid, $tag, $pagesize = 20, $pagetpl = '{first}{prev}{liststart}{list}{listend}{next}{last}')
{
    $cid = intval($cid);
    $catIDS = array();
    $terms = M("Terms")->field("term_id")->where("status=1 and ( term_id={$cid} OR path like '%-{$cid}-%' )")->order('term_id asc')->select();
    foreach ($terms as $item) {
        $catIDS[] = $item['term_id'];
    }
    if (!empty($catIDS)) {
        $catIDS = implode(",", $catIDS);
        $catIDS = "cid:{$catIDS};";
    } else {
        $catIDS = "";
    }
    $content = sp_sql_posts_paged($catIDS . $tag, $pagesize, $pagetpl);
    return $content;
}
    </div>
</div>
</div>

<?php 
$ntime = date('Y-m-d');
if (isset($_GET['ntime'])) {
    if ($_GET['ntime'] == 'begin') {
        $lists = sp_sql_posts_paged("cid:{$cat_id};order:post_keywords asc,listorder desc;where:post_keywords>'{$ntime}' or post_keywords = '{$ntime}';", 20, "{prev}{liststart}{list}{listend}{next}");
    } else {
        if ($_GET['ntime'] == 'over') {
            $lists = sp_sql_posts_paged("cid:{$cat_id};order:post_keywords desc,listorder desc;where:post_keywords<'{$ntime}';", 20, "{prev}{liststart}{list}{listend}{next}");
        }
    }
} else {
    $lists = sp_sql_posts_paged("cid:{$cat_id};order:post_keywords asc,listorder desc;where:post_keywords>'{$ntime}';", 20, "{prev}{liststart}{list}{listend}{next}");
}
$cterm = sp_get_child_terms($_GET['id']);
?>
<section class="contentbox">
	<div class="container">
    	<div class="conboxcon">
        	<div class="conboxcon_1">
                <div class="lecturecont">
                    <div class="lectext" style="margin-bottom:1px;">
                    	<div>
                    		<img class="img_float_left" src="/tpl/hualibootx/Public/images/jiangzuo.jpg" alt="" style="width:240px;height:102px;">
							<div class="oh">
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								<?php 
echo $description;
        echo $bn['label'];
        ?>
</a> &gt;<?php 
    }
}
?>
            &nbsp;<span><?php 
echo $nav_label;
?>
</span>
        </div>
    </div>
</div>
</div>
<?php 
$lists = sp_sql_posts_paged("cid:{$cat_id};order:post_modified DESC;", 15, "{prev}{liststart}{list}{listend}{next}");
$list_top = get_list_top($lists['posts']);
?>
<section class="contentbox">
	<div class="container">
    	<div class="conboxcon">
			<div class="conboxcon_1">
				<header class="contopdetail"><h3 class="aboutitle"><?php 
echo $nav_label;
?>
</h3></header>
				<div class="lecturecont">
					<?php 
if (is_array($list_top)) {
    $i = 0;
    $__LIST__ = $list_top;
<div class="col-md-6">
						<div class="service-item clearfix" style="background-color:#38A9E3;">
							<div class="service-icon">
								<i class="fa fa-pencil fa-2x"></i>
							</div>
							<div class="service-content">
								<h3><a href="javascript:void(0);" class="service_links" style="cursor: auto;"><?php 
                                        echo $ctidvo['name'];
                                        ?>
</a></h3>
								
							</div>
						</div>
						<?php 
                                        $cttid = $ctidvo['term_id'];
                                        $listsct = sp_sql_posts_paged("cid:{$cttid};order:listorder ASC;", 10);
                                        $listsct = $listsct['posts'];
                                        ?>
						<br>
						<?php 
                                        if (is_array($listsct)) {
                                            foreach ($listsct as $key => $cv) {
                                                ?>
<h4><a href="<?php 
                                                echo $cv['post_source'];
                                                ?>
" target="_blank"><?php 
                                                echo $cv['post_title'];
                                                ?>
</a></h4><?php 
                                            }
        echo $bn['label'];
        ?>
</a> &gt;<?php 
    }
}
?>
            &nbsp;<span><?php 
echo $nav_label;
?>
</span>
        </div>
    </div>
</div>
</div>
<?php 
$lists = sp_sql_posts_paged("cid:{$cat_id};order:post_date DESC;", 12, "{prev}{liststart}{list}{listend}{next}");
$list_top = get_list_top($lists['posts']);
?>
<section class="contentbox">
	<div class="container">
    	<div class="conboxcon">
			<div class="conboxcon_1">
				<header class="contopdetail"><h3 class="aboutitle"><?php 
echo $nav_label;
?>
</h3></header>
				<div class="lecturecont">
                    <ul class="sitebook">
                    	<?php 
if (is_array($lists['posts'])) {
    $i = 0;
</a>
                </dt><?php 
        }
    }
} else {
    echo "";
}
?>
                
            </dl>
        </div>
		<div class="main">                                            
			<?php 
$type = isset($_GET['type']) ? $_GET['type'] : $_GET['id'];
$type = isset($_GET['type']) ? $_GET['type'] : $_GET['id'];
$lists = $type == $_GET['id'] ? sp_sql_posts_paged_bycatid($_GET['id'], "order:listorder ASC,post_modified DESC;", 33, "{prev}{liststart}{list}{listend}{next}") : sp_sql_posts_paged("cid:{$type};order:listorder ASC,post_modified DESC;;", 33, "{prev}{liststart}{list}{listend}{next}");
?>
	    	<div style="height:100px;"></div>       
		    <div id="pageflow" class="page-content clearfix enable-waterflow waterfall-container">
		    	<?php 
if (is_array($lists['posts'])) {
    $i = 0;
    $__LIST__ = $lists['posts'];
    if (count($__LIST__) == 0) {
        echo "";
    } else {
        foreach ($__LIST__ as $key => $vo) {
            $mod = $i % 2;
            ++$i;
            ?>
<div class="block item">
?>
" />
   	<meta name="description" content="<?php 
echo $site_seo_description;
?>
">
	<meta charset="utf-8">
	<meta name="viewport" content="initial-scale=1">
	<link rel="stylesheet" href="/tpl/hualibootx/ActivitySonic/css/bootstrap.min.css">
	<link rel="stylesheet" href="/tpl/hualibootx/ActivitySonic/css/font-awesome.min.css">
	<link rel="stylesheet" href="/tpl/hualibootx/ActivitySonic/css/templatemo_misc.css">
	<link rel="stylesheet" href="/tpl/hualibootx/ActivitySonic/css/templatemo_style.css">
</head>
<body>
<?php 
$lists = sp_sql_posts_paged("cid:{$cat_id};order:listorder ASC;", 10);
$one = $lists['posts'][0];
$two = $lists['posts'][1];
$three = $lists['posts'][2];
$four = $lists['posts'][3];
$five = $lists['posts'][4];
$atlas = json_decode($four['smeta'], true);
$atlas = $atlas['photo'];
$atlas = array_chunk($atlas, 3);
?>
    <div class="responsive-navigation visible-sm visible-xs">
        <a href="#" class="menu-toggle-btn">
            <i class="fa fa-bars fa-2x"></i>
        </a>
        <div class="navigation responsive-menu">
            <ul>
        echo $bn['label'];
        ?>
</a> &gt;<?php 
    }
}
?>
            &nbsp;<span><?php 
echo $nav_label;
?>
</span>
        </div>
    </div>
</div>
</div>
<?php 
$lists = sp_sql_posts_paged("cid:{$cat_id};order:listorder ASC;", 15, "{prev}{liststart}{list}{listend}{next}");
$list_top = get_list_top($lists['posts']);
?>
<section class="contentbox">
	<div class="container">
    	<div class="conboxcon">
			<div class="conboxcon_1">
				<header class="contopdetail"><h3 class="aboutitle"><?php 
echo $nav_label;
?>
</h3></header>
				<div class="faqbox">
                	<dl class="faqlist">
                		<?php 
if (is_array($lists['posts'])) {
    $i = 0;