コード例 #1
0
function get_the_share_template($user_id = 0, $delClass = '')
{
    global $xt_album;
    $cacheObj = get_the_share_cachedata();
    $_item = isset($cacheObj['item']) ? $cacheObj['item'] : array();
    $_comment = isset($cacheObj['comment']) ? $cacheObj['comment'] : array();
    $_title = get_the_share_title();
    $_url = get_the_share_url();
    $_nick = xt_get_the_user_title(get_the_share_username());
    ?>
    <div class="span3 xt-share">
        <div class="thumbnail">
            <a href="<?php 
    echo $_url;
    ?>
" title="<?php 
    echo $_title;
    ?>
" target="_blank" class="xt-share-link">
                <img src="<?php 
    the_share_picurl();
    ?>
" title="<?php 
    echo $_title;
    ?>
" alt="<?php 
    echo $_title;
    ?>
" />
                <div class="xt-img-price">¥<?php 
    the_share_price();
    ?>
</div>
                <?php 
    echo get_the_admin_tool_share(get_the_share_id());
    ?>
                <?php 
    if ($user_id) {
        the_delete_template(get_the_share_id(), $delClass == 'xt-delete-album-share' ? $xt_album->id : 1, $user_id, $delClass);
    }
    ?>
                <span class="label label-album-add" data-id="<?php 
    the_share_id();
    ?>
" data-pic="<?php 
    the_share_picurl(160);
    ?>
">加入专辑</span>	
            </a>
            <div class="caption">
                <h5><?php 
    the_share_content();
    ?>
</h5>
                <div class="clearfix">
                    <a class="badge badge-fav" title="喜欢" data-id="<?php 
    the_share_id();
    ?>
" data-type="1" data-uid="<?php 
    the_share_userid();
    ?>
"><?php 
    the_share_favcount();
    ?>
<i class="icon-heart icon-white"></i></a>
                    <a class="badge badge-comment" title="评论" href="javascript:;" data-id="<?php 
    the_share_id();
    ?>
"><?php 
    the_share_commentcount();
    ?>
<i class="icon-comment icon-white"></i></a>
                </div>
            </div>
            <ul class="media-list clearfix">
                <li class="media">
                    <a class="pull-left X_Nick" data-value="<?php 
    echo get_the_share_userid();
    ?>
" target="_blank" href="<?php 
    xt_the_user_url(get_the_share_userid());
    ?>
"><img src="<?php 
    xt_the_user_pic(get_the_share_useravatar());
    ?>
" alt="<?php 
    echo $_nick;
    ?>
"></a>
                    <div class="media-body"><p class="muted"><a class="X_Nick" data-value="<?php 
    echo get_the_share_userid();
    ?>
" target="_blank" href="<?php 
    xt_the_user_url(get_the_share_userid());
    ?>
" class="xt-rep-nick"><?php 
    echo $_nick;
    ?>
        </a>分享了:<?php 
    echo wp_trim_words(get_the_share_title(), 15);
    ?>
    </p></div>
                </li>
                <?php 
    if (xt_is_displaycomment() && !empty($_comment) && isset($_comment['comments']) && !empty($_comment['comments'])) {
        $_comments = $_comment['comments'];
        foreach ($_comments as $c) {
            ?>
                        <li class="media">
                            <a class="pull-left X_Nick" data-value="<?php 
            echo $c['user_id'];
            ?>
" target="_blank" href="<?php 
            xt_the_user_url($c['user_id']);
            ?>
"><img src="<?php 
            xt_the_user_pic($c['pic_url']);
            ?>
" alt="<?php 
            xt_the_user_title($c['nick']);
            ?>
"></a>
                            <div class="media-body"><p class="muted"><a class="X_Nick" data-value="<?php 
            echo $c['user_id'];
            ?>
" target="_blank" href="<?php 
            xt_the_user_url($c['user_id']);
            ?>
" class="xt-rep-nick"><?php 
            xt_the_user_title($c['nick']);
            ?>
        </a>:<?php 
            xt_comment_excerpt(0, $c['content']);
            ?>
    </p></div>
                        </li>
                        <?php 
        }
        if (isset($_comment['total']) && $_comment['total'] > 2) {
            echo '<li class="xt-rep-more"><a href="' . $_url . '" target="_blank" rel="nofollow"> 查看全部' . $_comment['total'] . '条评论...</a></li>';
        }
    }
    ?>
            </ul>
        </div>
    </div>
    <?php 
}
コード例 #2
0
<div class="row-fluid">
	<div id="X_Share-Comments-List" class="span12" style="min-height:0px;">
		<ul class="media-list">
		<?php 
$_isAjax = defined('DOING_AJAX') ? true : false;
$_page = 1;
if ($_isAjax) {
    $_share_id = $_POST['share_id'];
    $_page = isset($_POST['page']) ? $_POST['page'] : 1;
} else {
    $_share_id = get_the_share_id();
}
if (!empty($_share_id) && (!$_isAjax && get_the_share_commentcount() > 0 || $_isAjax)) {
    query_comments(array('share_id' => $_share_id, 'page' => $_page));
    while (xt_have_comments()) {
        xt_comment_template();
    }
}
?>
		</ul>
		<div id="X_Share-Comments-Page" class="xt-share-comments-page">
			<div class="pagination" style="text-align:right">
				<?php 
xt_comments_pagination_links();
?>
			</div>
		</div>	
	</div>
</div>