第七步:前台挪用模版 list_c.html
<div class="main"><div class="crumbs"><a href=http://down.chinaz.com/"{$domain}">{$name}</a><span> > </span><a>{$position_info[name]}</a> </div>
<div class="box">
<div class="content">
{$num}
{pc:get sql="select * from `wecheposition_data` where `siteid`=$siteid and `posid`=$posid order by id desc" page="$page" num="25" start="$offset" return="data" }
<ul class="list f14 lh26 row-2">
{loop $data $r}
<?php
$arr=getidurl($r['catid'],$r['id'],$r['modelid'])
?>
<li><a href=http://down.chinaz.com/"{$arr['caturl']}" target="_blank">[{$arr['catname']}]</a><a href=http://down.chinaz.com/"{$arr['url']}" target="_blank">{str_cut($arr['title'], 40)}{date("Y-m-d",$arr['inputtime'])}</a></li>
{/loop}
</ul>
{/pc}
</div>
<div id="pages" class="text-c">{$pages}</div>
</div>
</div>
@chmod($file,0777);
if(!is_writable($file)) {
$file = str_replace(PHPCMS_PATH,'',$file);
showmessage(L('file').':'.$file.'<br>'.L('not_writable'));
}
return $strlen;
}
好了各人生存测试生成下,今朝支持的多站点,单个推荐位的更新。别的个中涉及到一个函数:getidurl($r['catid'],$r['id'],$r['modelid']);
送上此函数的代码放在扩展函数内里:\v9.com\phpcms\libs\functions\extention.func.php
/*获取单条信息新闻信息
该函数由蝌蚪编写
$id 新闻ID
$modelid 模子id
$catid 为栏目ID
*/
function getidurl($catid,$id,$modelid)
{
$cid=intval($catid);
$db=pc_base::load_model('content_model');
$db->table_name='wechemodel';
$r=$db->get_one("`modelid`={$modelid}");
$db->table_name="weche".$r['tablename'];
$n=$db->get_one("`id`={$id}");
$array=array();
$array['url']=$n['url'];
$array['title']=$n['title'];
$array['description']=$n['title'];
$array['updatetime']=$n['updatetime'];
$array['inputtime']=$n['inputtime'];
$db->table_name="wechecategory";
$c=$db->get_one("`catid`={$catid}");
$array['catname']=$c['catname'];
$sid=$c['siteid'];
$db->table_name='wechesite';
$s=$db->get_one("`siteid`={$sid}");
if(stripos($c['catname'],"")) $array['caturl']=$c['url'];
else {
$siteurl=$s['domain'];
$array['caturl']=$siteurl.$c['url'];
}
return $array;
}
phpcms v9 推荐位 生成列表页 更多内容 。
PHPCMS v9.6.0 GBK下载