使用方法:进入蝉知后台--平台--插件--获得插件--找到“高级自定义区块”--自动安装。 安装完成后:后台--设计区块--新建区块--选择“魔术区块类型”--复制区块--选择需要的共享区块进行复制。
最新留言
5

2015/12/27
看看有文明
回复
3
CHU 2015-12-26 18:02:37
回复测试2
louis 2016-12-17 14:00:03
为什么显示不出评论呢?
CHU 2017-02-15 13:20:37
需要审核后显示
来来来
2015/12/26
留言测试222
回复

html源码

区块CSS

#blockID
{
  /*.panel-heading {}*/
  /*.panel-body    {}*/

    .comment {display: table; border: 1px solid #ddd; border-radius: 0px; transition: all .5s cubic-bezier(.175,.885,.32,1); 
    box-shadow: 0 1px 2px rgba(0,0,0,.075); margin-bottom: 10px; padding: 0; max-width:100%;}
    .comment:before {display: none}
    .comment.first{ border-radius: 0 0 0px 0px;}
    .comment-id, .comment-content {display: table-cell; padding: 8px;}
    .comment-id.success{background:#e5ffe6;}
    .comment-id {vertical-align: middle; font-size: 12px; font-weight: 400; color: #888; text-align: center; background: #f1f1f1; border-right: 1px solid #ddd; width: 60px;}
    .reply > .reply-content:first-child {padding-top: 2px; margin-top: 5px;}
    
    .comment table.table{margin-bottom:0; max-width:100%; word-wrap:break-word;}
    .comment table.table tr{border-top: 1px solid #ddd;}
    .comment table.table tr:first-child{border-top:0;}
    th.th-from{text-align:center; padding-right:0;width:100px;border-right:solid 1px #f1f1f1;vertical-align:middle;}
    td.td-action{width:50px;}
    td.td-content{word-wrap: break-word; word-break:break-all;}
    .time{font-size:10px; font-weight:normal;color:inherit;}
    table tr.reply .th-from{font-weight:normal}
    
    .signed-user-info {display: inline-block; padding-top: 6px; vertical-align: middle; margin-right: 8px;}
    .content-abstract {height: 100px; overflow: hidden;}
}

区块JS

$(document).ready(function(){
    $('#blockID').addClass('panel panel-block');
});

区块内容

<?php 
$this->loadModel('message');
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal = 0, $recPerPage, $pageID = 1);
$messages = $this->message->getByObject($type = 'message', $objectType = 'message', $objectID = 0, $pager);
?>
<?php js::set('showDetail', $this->lang->message->showDetail);?>
<?php js::set('hideDetail', $this->lang->message->hideDetail);?>
<div class='panel-heading'><strong><i class='icon-comment-alt'></i> 最新留言</strong></div>
<div class='panel-body'>
    <?php if(!empty($messages)):?>
    <?php $class = 'success';?>
    <?php foreach($messages as $number => $message):?>
    <?php $class = $class == 'success' ? '' : 'success';?>
    <div class='comment w-p100' id="comment<?php echo $message->id?>">
      <div class='<?php echo $class;?> comment-id'><?php echo $message->id?></div>
      <table class='table table-borderless w-p100'>
        <tr>
        <th class='th-from'>
          <?php echo $message->from;?><br>
          <span class='time'> <?php echo formatTime($message->date, 'Y/m/d');?> </span>
        </th>
        <td class='td-content'>
          <div class='content-detail'><?php echo nl2br($message->content);?></div>
        </td>
        <td class='td-action'> <?php echo html::a(helper::createLink('message', 'reply', "messageID=$message->id"), $this->lang->message->reply, "data-toggle='modal' data-type='iframe' data-icon='reply' data-title='{$this->lang->message->reply}'");?> </td>
        </tr>
        <?php $this->message->getFrontReplies($message);?>
      </table>
    </div>
    <?php endforeach; ?>
    <?php endif;?>
</div>
<script>
$(document).ready(function(){
    /* Process contents. */
    $('.content-detail').each(function()
    {
        var obj = $(this);
        if(obj.height() > 100)
        {
            var buttons = "<a href='javascript:void(0)' onclick='showDetail(this)' class='showDetail'> ... " + v.showDetail + "</a>";
            buttons    += "<a href='javascript:void(0)' onclick='hideDetail(this)' class='hideDetail'> " + v.hideDetail + "</a>";    
            obj.parent().append(buttons);
            obj.parent().find('.hideDetail').hide();
            obj.addClass('content-abstract');
        }
    });  
});
function showDetail(obj)
{
    var tdContent = $(obj).parents('.td-content');
    tdContent.find('.content-detail').removeClass('content-abstract');
    tdContent.find('.showDetail').hide();
    tdContent.find('.hideDetail').show();
}

function hideDetail(obj)
{
    var tdContent = $(obj).parents('.td-content');
    tdContent.find('.content-detail').addClass('content-abstract');
    tdContent.find('.showDetail').show();
    tdContent.find('.hideDetail').hide();
}
</script>

区块列表

全部共享区块