自定义标签

燃烧的冰2019-12-28  5.2K+

主页,频道页,列表页,详情页,都调用了自定义标签,自定义标签下的主题数据跟列表主题数据一致,对应的变量命名 $flaglist

 

调用方法

 
<?php if($flaglist){ ?>
	<div class="col-lg-3 d-none d-lg-block aside">
		<?php foreach($flaglist as $_flag) { ?>
        <div class="d-none d-lg-block aside shadow mb-3">
            <div class="card-header bg-light">
                <h3 class="h6 font-weight-bold my-0">

                    <!-- 自定义标签名 -->
					<a href="<?php echo $_flag['url'];?>" title='<?php echo $_flag['name'];?>' aria-label='<?php echo $_flag['name'];?>'>
                        <?php echo $_flag['name']; ?>
                    </a>
				</h3>
			</div>
            <ul class="list-unstyled threadlist list-group list-group-flush nowrap">

                <!-- 循环输出主题 -->
				<?php if(isset($_flag['list'])){foreach($_flag['list'] as $_thread) { ?>
                <li class="thread bg-white">
                    <h4 class="h6 my-0 mx-3">

                        <!-- 输出主题数据,包含了主题外链 -->
						<a href="<?php echo $_thread['url'];?>" class="d-block ellipsis" <?php echo (10==$_thread['type']?'rel="nofollow" target="_blank"':''); ?> title='<?php echo $_thread['subject'];?>' aria-label='<?php echo $_thread['subject'];?>'>
                            <?php echo $_thread['subject'];?>
						</a>
					</h4>
				</li>
				<?php }} ?>
			</ul>
		</div>
		<?php } ?>
	</div>
    <?php } ?>
0