设为首页收藏本站
查看: 63|回复: 0

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

[复制链接]

论坛元老

Rank: 6Rank: 6

积分
34274
主题
17031
UID
1347
M币
67
贡献
17176

  • 发表于 2014-3-27 18:17:00 | 显示全部楼层 |阅读模式
    请问如何在内容模板中写标题和内容呢
    这是php文件,请问如何在内容模板中写标题和内容呢?请大神给写一个单条内容的模板。谢谢了,,由于代码太长,我删了一部份,急用,谢谢各位好心人了


    spArgs('uid')){
    $uid = (int) $this->spArgs('uid');
    $cond = "and b.uid = '$uid'";
    }
    if($this->spArgs('pagelimit')){
    $pageLimit = ($this->spArgs('pagelimit') 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);
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    在我站开通SVIP可同时获得17个站点VIP资源 立即登录 立即注册
    快速回复 返回顶部 返回列表