typecho主题制作教程(17)分离文章的评论和引用通告

. 分享 . 36 吐槽 . 186人围观

分离文章的评论和引用通告

打开模板的 comments.php 文件,找到通篇的核心语句:

<?php $this->comments()->to($comments); ?>

这条语句控制着评论的类型,他的参数如下:

语句注释
<?php $this→comments()→to($comments); ?>显示全部(默认)
<?php $this→comments('comment')→to($comments); ?>只显示 comment
<?php $this→comments('trackback')→to($trackbacks); ?>只显示 trackback
<?php $this→comments('pingback')→to($pingbacks); ?>只显示 pingback

为了分开,我们开始对 comments.php 做如下修改,首先只显示评论:

<?php $this->comments('comment')->to($comments); ?><!-- 关键 -->
<?php if ($comments->have()) : ?>
    <ol>
    <?php while ($comments->next()) : ?>
    <li id="<?php $comments->theId() ?>">
        <div class="comment_data">
            <?php $comments->gravatar(32, '', '', 'avatar'); ?>
            <span><?php $comments->author() ?></span> Says:<br />
            <?php $comments->date('F jS, Y'); ?> at <?php $comments->date('h:i a'); ?>
        </div>
        <div class="comment_text"><?php $comments->content() ?></div>
    </li>
    <?php endwhile; ?>
    </ol>
<?php endif; ?>

然后输出 pingback,pingback 并不需要那么多的展示内容,假设只展示标题和日期:

<?php $this->comments('pingback')->to($pingbacks); ?><!-- 关键 -->
<?php if ($pingbacks->have()) : ?>
    <h3>Pingbacks</h3>
    <ol>
    <?php while ($pingbacks->[next](http://www.php.net/next)()) : ?>
        <li id="<?php $pingbacks->theId() ?>">
            <?php $pingbacks->author() ?> <?php $pingbacks->[date](http://www.php.net/date)('F jS, Y'); ?>
        </li>
    <?php endwhile; ?>
    </ol>
<?php endif; ?>

如果你要显示 trackback,也可以按如上的修改。typecho 模板语法很多是通用的,所以当你遇到不清楚的问题时,可以自己试着拼凑一下,就会有惊喜哦。

「一键投喂 软糖/蛋糕/布丁/牛奶/冰阔乐!」

孤独患者

嘤嘤嘤 ~ 您的爱心大炮射中了我 开心开心

使用微信扫描二维码完成支付

# 你可能在找...

评论
  1. Come Comprare Priligy buy viagra Where To Buy 3 10percent Cream Eurax Buy Plavix Cheap Medicament Zithromax

    回复
  2. Tiempo Libre De Propecia generic cialis canada Propecia Online Purchase Cialis Generique En 24h

    回复
  3. Diferencias Entre Sildenafil Y Kamagra Zithromax Cost At Publix generic cialis overnight delivery Viagra Baja La Presion

    回复
  4. Priligy Cyprus Comment Acheter Du Viagra En Suisse viagra Effet Viagra Fertilite Levitra Dopo Mangiato

    回复
  5. vdp hyper casinos

    回复
  6. kfq best cbd oil

    回复
  7. Health pae.ceme.illed.cn.yxk.lp spirometry expanded providing [URL=http://thenectarystpaul.com/levitra/ - discount levitra[/URL - [URL=http://anguillacayseniorliving.com/tadalafil/ - cialis[/URL - [URL=http://diversepartnersnetwork.net/generic-viagra/ - buy viagra cheap[/URL - [URL=http://trucknoww.com/buy-accutane-online/ - accutane[/URL - [URL=http://diversepartnersnetwork.net/cialis-coupon/ - cialis[/URL - [URL=http://anguillacayseniorliving.com/prednisone/ - no rx prednisone[/URL - prednisone [URL=http://pintlersuites.com/vidalista/ - vidalista for sale[/URL - [URL=http://anguillacayseniorliving.com/propecia/ - cheap propecia[/URL - logistics wastes levitra 500 canada cialis cialis vs viagra buy accutane isotretinoin cialis prednisone without prescription vidalista cheap propecia heart, http://thenectarystpaul.com/levitra/#sample-levitra levitra generic levitra online http://anguillacayseniorliving.com/tadalafil/#cialis-online cialis http://diversepartnersnetwork.net/generic-viagra/#generic-viagra generic viagra http://trucknoww.com/buy-accutane-online/#accutane accutane generic http://diversepartnersnetwork.net/cialis-coupon/#cialis cialis coupon http://anguillacayseniorliving.com/prednisone/#buy-prednisone-online prednisone online prednisone with no prescription http://pintlersuites.com/vidalista/#online-vidalista generic vidalista http://anguillacayseniorliving.com/propecia/#cheap-propecia propecia hags dorsiflexion.

    回复
  8. tpw cbd oil for sale walmart

    回复
  9. V rvb.wzuh.illed.cn.hkp.qu dyspepsia pillow driving, [URL=http://diversepartnersnetwork.net/buy-accutane-online/ - cheap accutane[/URL - [URL=http://gaiaenergysystems.com/walmart-viagra-100mg-price/ - walmart viagra 100mg price[/URL - [URL=http://anguillacayseniorliving.com/prednisone-20-mg/ - prednisone without prescription.net[/URL - [URL=http://pintlersuites.com/questran--online/ - buy questran[/URL - [URL=http://tofupost.com/retin-a/ - retin-a[/URL - [URL=http://anguillacayseniorliving.com/propecia/ - propecia on line[/URL - [URL=http://tacticaltomahawkreviews.com/vibramycin/ - vibramycin[/URL - [URL=http://foodfhonebook.com/neurontin/ - neurontin lowest price[/URL - odour accutane viagra discovery lawsuits of blindness prednisone without prescription.net questran lowest price retin-a cream cheap propecia online vibramycin vibramycin neurontin absorption, irritability, http://diversepartnersnetwork.net/buy-accutane-online/#accutane buy generic accutane http://gaiaenergysystems.com/walmart-viagra-100mg-price/#100-mg-viagra-lowest-price viagra pr http://anguillacayseniorliving.com/prednisone-20-mg/#prednisone prednisone 20 mg http://pintlersuites.com/questran--online/#questran--online questran http://tofupost.com/retin-a/#retin-a-cream-0.05 obagi 1 tretinoin http://anguillacayseniorliving.com/propecia/#order-propecia propecia http://tacticaltomahawkreviews.com/vibramycin/#vibramycin vibramycin http://foodfhonebook.com/neurontin/#neurontin-lowest-price discount neurontin hiatus, disastrous, disruption.

    回复
  10. The tax.okdi.illed.cn.hpb.ju blanches haemorrhage abduct [URL=http://trucknoww.com/online-pharmacy/ - canadian pharmacy[/URL - [URL=http://trucknoww.com/viagra-online/ - generic viagra[/URL - [URL=http://thenectarystpaul.com/prednisone/ - prednisone without a prescription[/URL - [URL=http://gaiaenergysystems.com/tadalafil-20-mg/ - cialis india[/URL - [URL=http://thenectarystpaul.com/viagra/ - viagra buy online[/URL - laryngospasm, canadian pharmacy viagra prednisone online cialis in italy viagra explained opposition http://trucknoww.com/online-pharmacy/#pharmacy canadian online pharmacy http://trucknoww.com/viagra-online/#viagra-and-blindness how do you buy viagra at http://thenectarystpaul.com/prednisone/#online-prednisone prednisone no prescription http://gaiaenergysystems.com/tadalafil-20-mg/#20mg-cialis cialis http://thenectarystpaul.com/viagra/#viagra-generic viagra paraplegics, streps.

    回复
  11. payday lenders quick loans simple loan bad credit loans payday loans online

    回复
  12. odb hemp oil cbd

    回复
  13. xla hemp oil vs cbd oil

    回复
  14. vth cbd oil florida

    回复
  15. zkp walgreens cbd oil

    回复
  16. cvn buy cbd usa

    回复
  17. xqt casino bonus

    回复
  18. lev online gambling

    回复
  19. wyy zilis cbd oil

    回复
  20. wdm vegas slots

    回复
  21. wpf cbd oil

    回复
  22. fdz hemp oil benefits

    回复
  23. hqq cbd oil benefits

    回复
  24. kib free casino games online

    回复
  25. fry play free vegas casino games

    回复
  26. fcl cbd pure hemp oil

    回复
  27. prednisone 20mg tablets

    回复
  28. ptp green roads cbd oil

    回复
  29. oks free slots

    回复
  30. nsv online casino slots

    回复
  31. cdd best cbd oil

    回复
  32. agt buy cbd usa

    回复
  33. buy antabuse on line viagra non prescription buying trazodone online furosemide lasix prescription prednisolone metformin 850 ventolin hfa buy prednisone online canada without prescription buy suhagra

    回复
  34. fkd vegas world slots

    回复
  35. pms benefits of cbd oil

    回复
  36. Typically kgs.uotb.illed.cn.cmd.qw caval successful: [URL=http://pintlersuites.com/flexeril/ - flexeril and lexapro drug interactions[/URL - [URL=http://tacticaltomahawkreviews.com/cialis-professional/ - cialis professional lowest price[/URL - [URL=http://tofupost.com/generic-cialis/ - cialis[/URL - [URL=http://anguillacayseniorliving.com/buy-viagra/ - buy viagra[/URL - [URL=http://diversepartnersnetwork.net/retin-a/ - retin-a[/URL - [URL=http://foodfhonebook.com/cialis-super-force/ - discount cialis super force[/URL - [URL=http://tofupost.com/propecia-online/ - buy propecia[/URL - [URL=http://tacticaltomahawkreviews.com/cialis-super-active/ - cialis super active without dr prescription[/URL - sooner fall herniate, how to get off flexeril loxidol cialis professional stericlene 15 cialis generic viagra retin a cream order cialis super force online propecia on line cialis super active surfaces, http://pintlersuites.com/flexeril/#flexeril--generic amoxicillin clavulanic acid natravox flexeril striadyne indication http://tacticaltomahawkreviews.com/cialis-professional/#cialis-professional-description buy cialis professional uk http://tofupost.com/generic-cialis/#cialis-tachycardia cialis for dog cardiac problems http://anguillacayseniorliving.com/buy-viagra/#discount-viagra pharmacie ligne viagra viagra generic http://diversepartnersnetwork.net/retin-a/#tretinoin-cream retin-a http://foodfhonebook.com/cialis-super-force/#cialis-super-force cialis super force pills cialis super force http://tofupost.com/propecia-online/#propecia-for-sale buy propecia propecia buy http://tacticaltomahawkreviews.com/cialis-super-active/#cialis-super-active-without-a-prescription cialis super active for sale post-eczema encountered.

    回复