public function index()
 {
     if (empty($_GET['name']) || empty($_GET['version'])) {
         $post = sp_sql_posts('cid:11,12;field:term_id,post_title,post_date,post_content,post_excerpt;order:post_date desc');
         $this->assign('post', $post);
         $this->display(":download");
     } else {
         header('Content-type: text/html;charset=UTF-8');
         $datetime = date('Y-m-d H:i:s');
         $ip = $_SERVER["REMOTE_ADDR"];
         $name = $_GET['name'];
         $version = $_GET['version'];
         $packdate = $_GET['packdate'];
         $pefurl = $_SERVER["HTTP_REFERER"];
         //获取完整的来路URL
         $data = array('ip' => $ip, 'pefurl' => $pefurl, 'version' => $version, 'packdate' => $packdate, 'datetime' => $datetime);
         M('Download')->add($data);
         $downurl = "http://iservice-thinkcmf.stor.sinaapp.com/" . $name . "_" . $version . "_" . $packdate . ".zip";
         header("Location:" . $downurl);
     }
 }
		<div class="span4">
			 <h2 class="font-large nospace"><i class="fa fa-cubes"></i> 应用模块化</h2>
             <p>提出全新的应用模式进行扩展,不管是你开发一个小功能还是一个全新的站点,在ThinkCMF中你只是增加了一个APP,每个独立运行互不影响,便于灵活扩展和二次开发。</p>
		</div>
		<div class="span4">
			  <h2 class="font-large nospace"><i class="fa fa-certificate"></i> 免费开源</h2>
              <p>代码遵循Apache2开源协议,免费使用,对商业用户也无任何限制。</p>
		</div>
	</div>
	
	<div>
		<h1 class="text-center">最新资讯</h1>
		<h3 class="text-center">Last News</h3>
	</div>
	<?php 
$lastnews = sp_sql_posts("cid:{$portal_index_lastnews};field:post_title,post_excerpt,tid,smeta;order:listorder asc;limit:4;");
?>
	<div class="row">
		<?php 
if (is_array($lastnews)) {
    foreach ($lastnews as $key => $vo) {
        $smeta = json_decode($vo['smeta'], true);
        ?>
		<div class="span3">
			<div class="tc-gridbox">
				<div class="header">
					<div class="item-image">
						<a href="<?php 
        echo leuu('article/index', array('id' => $vo['tid']));
        ?>
">
Beispiel #3
0
/**
 * 功能:根据分类文章分类ID 获取该分类下所有文章(包含子分类中文章),调用方式同sp_sql_posts
 * @author labulaka 2014-11-09 14:30:49
 * @param int $cid 文章分类ID.
 * @param string $tag  查询标签,以字符串方式传入,例:"cid:1,2;field:post_title,post_content;limit:0,8;order:post_date desc,listorder desc;where:id>0;"<br>
 * 		cid:数据所在分类,可调出一个或多个分类数据,如 1,2,3 默认值为全部,在当前分类为:'.$cid.'<br>
 * 		field:调用post指定字段,如(id,post_title...) 默认全部
 * 		limit:数据条数,默认值为10,可以指定从第几条开始,如3,8(表示共调用8条,从第3条开始)
 * 		order:排序方式,如:post_date desc<br>
 * 		where:查询条件,字符串形式,和sql语句一样
 * @param array $where 查询条件,(暂只支持数组),格式和thinkphp where方法一样;
 */
function sp_sql_posts_bycatid($cid, $tag, $where = array())
{
    $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($catIDS . $tag, $where);
    return $content;
}
 public function sidebar()
 {
     $fun = sp_sql_posts('cid:13;order:listorder asc;field:post_title,object_id;');
     $this->assign("fun", $fun);
     $this->display('sidebar');
 }
    }
}
?>
         </ul>
      </nav>
   </div>
</header>

<?php 
$term = sp_get_term($_GET['id']);
$child_terms = sp_get_child_terms($term['parent']);
$pterm = sp_get_term($term['parent']);
$nav_label = $pterm['name'];
$cid = $_GET['id'];
$tag = "cid:{$cid};field:post_title,post_content,smeta;order:listorder asc";
$posts = sp_sql_posts($tag);
$flist = $posts[0];
$smeta = json_decode($flist['smeta'], true);
$nav_label = isset($nav_label) ? $nav_label : $post_title;
$nid = sp_nav_id($nav_label);
$nav_cid = sp_nav_cid($nid);
if ($nav_cid == 1) {
    $navList = tree_to_list($navTree);
} else {
    $navT = sp_get_menu_tree($nav_cid);
    $navList = tree_to_list($navT);
}
$snav = getParents($navList, $nid);
$parent_sid = $snav[0]['id'];
$parent_slabel = $snav[0]['label'];
$parent_shref = $snav[0]['href'];
		<div class="span3">
			<div class="tc-box first-box">
				<div class="headtitle">
	          		<h2>分享</h2>
	          	</div>
	          	<div class="bdsharebuttonbox"><a href="#" class="bds_more" data-cmd="more"></a><a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a><a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"></a></div>
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"2","bdSize":"32"},"share":{},"image":{"viewList":["weixin","tsina","qzone","tqq","renren"],"viewText":"分享到:","viewSize":"32"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["weixin","tsina","qzone","tqq","renren"]}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
        	</div>
        	
        	<div class="tc-box">
	        	<div class="headtitle">
	        		<h2>热门文章</h2>
	        	</div>
	        	<div class="ranking">
	        		<?php 
$hot_articles = sp_sql_posts("cid:{$portal_index_lastnews};field:post_title,post_excerpt,tid,smeta;order:post_hits desc;limit:5;");
?>
		        	<ul class="unstyled">
		        		<?php 
if (is_array($hot_articles)) {
    foreach ($hot_articles as $key => $vo) {
        $top = $key < 3 ? "top3" : "";
        ?>
							<li class="<?php 
        echo $top;
        ?>
"><i><?php 
        echo $key + 1;
        ?>
</i><a title="<?php 
        echo $vo["post_title"];