当前位置:Gxlcms > PHP教程 > 请教怎么在内容模板中写标题和内容呢

请教怎么在内容模板中写标题和内容呢

时间:2021-07-01 10:21:17 帮助过:11人阅读

请问如何在内容模板中写标题和内容呢
这是php文件,请问如何在内容模板中写标题和内容呢?请大神给写一个单条内容的模板。谢谢了,,由于代码太长,我删了一部份,急用,谢谢各位好心人了



class blog extends top
{

function __construct(){
parent::__construct();
}


//获取feeds
function feeds(){
if($this->spArgs('uid')){
$uid = (int) $this->spArgs('uid');
$cond = "and b.uid = '$uid'";
}
if($this->spArgs('pagelimit')){
$pageLimit = ($this->spArgs('pagelimit') < 30) ? $this->spArgs('pagelimit') : 30 ; //自定义分页
}else{
$pageLimit = $this->yb['show_page_num'];
}


//LEFT JOIN `".DBPRE."follow` AS f ON ( b.uid = f.touid and f.uid = '$uid' )
$sql = "SELECT b. * , k.id AS likeid ,m.username,m.domain
FROM `".DBPRE."blog` AS b LEFT JOIN `".DBPRE."likes` AS k ON ( b.bid = k.bid AND k.uid ='$this->uid' )
LEFT JOIN `".DBPRE."member` as m on b.uid = m.uid where b.open = 1 $cond ORDER BY b.time desc";

$data['blog'] = spClass('db_blog')->spPager($this->spArgs('page',1),$pageLimit)->findSql($sql);
$data['page'] = spClass('db_blog')->spPager()->getPager();
unset($data['page']['all_pages']);
if(!empty($data['blog'])){
foreach($data['blog'] as &$d){
$this->foramt_feeds($d);
}
$this->api_success($data);
}else{
$this->api_success("");
}
}


//获取单个博客
function getOneBlog(){
$bid = (int) $this->spArgs('bid');
$sql = "SELECT b. * , k.id AS likeid ,m.username,m.domain
FROM `".DBPRE."blog` AS b LEFT JOIN `".DBPRE."likes` AS k ON ( b.bid = k.bid AND k.uid ='$this->uid' )
LEFT JOIN `".DBPRE."member` as m on b.uid = m.uid where b.open in (1,-2) and b.bid = '$bid'";
$data['blog'] = spClass('db_blog')->findSql($sql);
foreach($data['blog'] as &$d){
$this->foramt_feeds($d,0);
}
$this->api_success($data);
}



//获取我关注的用户feeds
function followfeeds(){
$followuid = spClass('db_follow')->getFollowUid($this->uid);
if($followuid){
$sql = "SELECT b. * , k.id AS likeid ,m.username,m.domain
FROM `".DBPRE."blog` AS b LEFT JOIN `".DBPRE."likes` AS k ON ( b.bid = k.bid AND k.uid ='$this->uid' )
LEFT JOIN `".DBPRE."member` as m on b.uid = m.uid where b.open = 1";
$sql .= " and b.uid in ($followuid) and b.open=1 ORDER BY b.time desc";
$data['blog'] = spClass('db_blog')->spPager($this->spArgs('page',1),10)->findSql($sql);
$data['page'] = spClass('db_blog')->spPager()->getPager();

foreach($data['blog'] as &$d){
$this->foramt_feeds($d);
}
}
$this->api_success($data);

人气教程排行