主题详情

燃烧的冰2019-12-28  970

主题详情页部分扁平和门户,对应的文件为 view/htm/read.htm

 

单页详情 对应的文件为 view/htm/single_page.htm

 

//----- 页面当前位置和链接 -----

		<ol class="breadcrumb d-none d-md-flex shadow border-light border-left-primary">
			<li class="breadcrumb-item">
				<a href="<?php echo $conf['path'];?>" aria-label="<?php echo lang('index_page'); ?>">
					<i class="icon-home text-primary"></i>
				</a>
			</li>
			<li class="breadcrumb-item">
                <a href="<?php echo $forum['url']; ?>">
                    <?php echo $forum['name'];?>
                </a>
            </li>
			<li class="breadcrumb-item active">
                <a href="<?php echo $thread['url']; ?>" title="<?php echo lang('index_page');?>返回主题第一页">
                    <?php echo $thread['subject'];?>
                </a>
            </li>
		</ol>

 

//----- 内容  -----

<div class="card card-thread shadow border-white mb-3">
			<div class="card-body">
				<div class="media">
					<!-- 发表内容的用户头像 -->
					<a href="<?php echo url('user-'.$thread['uid']);?>" tabindex="-1">
						<img class="avatar-3 mr-3" src="<?php echo $thread['user_avatar_url'];?>">
					</a>
					<div class="media-body subject">
						<h1 class="h5 text-break font-weight-bold">
                            <!-- 主题 -->
							<?php echo $thread['subject'];?>
						</h1>
						<div class="d-flex justify-content-between">
							<div>
								<span>
                                    <!-- 内容作者 -->
									<a href="<?php echo url('user-'.$thread['uid']);?>" class="text-muted">
                                        <?php echo $thread['username'];?>
                                    </a>
								</span>
								<span class="date text-grey ml-2">
                                    <!-- 主题发布时间 -->
                                    <?php echo $thread['create_date_fmt_ymd'];?>
                                </span>
								<span class="text-grey ml-2"><i class="icon-eye"></i>&nbsp;
                                    <!-- 主题浏览次数 -->
                                    <?php echo format_number($thread['views']);?>
                                </span>
							</div>

                            <!-- 编辑,要返回后台,不需要可删除 -->
                            <div>
                            <?php if($allowdelete || $allowupdate) { ?>
                            <span class="dropdown">
                                <a class="dropdown-toggle" data-toggle="dropdown" href="javascript:void(0);" role="button" aria-haspopup="true" aria-expanded="false">
                                    <?php echo lang('manage');?>
                                </a>
                                <span class="dropdown-menu dropdown-menu-right animated--fade-in-up shadow border-left-primary py-0">
									<?php if($allowdelete) { ?>
									<a data-href="<?php echo url('operate-delete-'.$tid);?>" href="javascript:void(0);" class="dropdown-item post_delete">
                                    <?php echo lang('delete');?>
                                    </a>
									<?php } ?>
                                </span>
                            </span>
                            <?php } ?>
                            </div>
						</div>
					</div>
				</div>
				<hr />
                <!-- message 和 text-break 两个class必须保留 -->
				<div class="message text-break">
                    <!-- 如果有评论 并且评论分页 则第一页显示内容 第二页之后只显示标题 -->
				<?php if(1 == $page) { ?>
					<!--需要 主图 文字环绕 删除下面的注释代码即可-->
                    <!--<div class="clearfix float-left mx-2">
                        <img src="<?php echo $thread['icon_fmt'];?>" alt="<?php echo $thread['subject'];?>" />
                    </div>-->

                    <!-- 内容 -->
					<?php echo $data['message'];?>

                    <!-- 附件 -->
					<?php echo data_file_list_html($thread['filelist']);?>
				<?php } else { ?>

                    <!-- 评论第二页显示标题 -->
					<p>
                        <a href="<?php echo $thread['url']; ?>">
                            <?php echo lang('view_thread_message');?>
                        </a>
                    </p>
				<?php } ?>
				</div>

                <!-- 插件位置 自制版模板删除,即使留了也有很多地方不兼容 -->
				<div class="plugin d-flex justify-content-center mt-3">
					<!--{hook read_plugin_body.htm}-->
				</div>

                <!-- 判断是否有tag --> 
				<?php if (1 == $page) { ?>
				<?php if ($thread['tag']) { ?>
				<hr>
				<div class="row">
					<div class="col-lg-12 text-muted mt-2">
						<i class="icon-tags mr-2"></i>
						<?php foreach($thread['tag_fmt'] as $_tag => $_tagname) { ?>
						<span class="badge border border-secondary mr-2">
                            <h2 class="h6 mb-0 small">
                                <a class="text-secondary" href="<?php echo url('tag-' . $_tag);?>">
                                    <?php echo $_tagname; ?>
                                </a>
							</h2>
                        </span>
						<?php }?>

					</div>
				</div>
				<?php }?>
				<?php }?>
			</div>
		</div>
 

//----- 评论和评论分页  -----

<?php if ($allowpost) { ?>

		<div class="card card-postlist border-white shadow">
			<div class="card-body">
				<div class="card-title">
					<div class="d-flex justify-content-between">
						<div>
							<b>
                                <!-- 评论数量 -->
                                <?php echo lang('new_post');?>
                            </b>(<span class="posts"><?php echo $thread['posts'];?></span>)
						</div>

						<div>
                            <!-- 钩子,自制模板删除即可 -->
							<!--{hook read_comment_list_title_right.htm}-->
						</div>
					</div>
				</div>

				<ul class="postlist list-group list-group-flush">

                    <!-- 加载公用评论列表文件 -->
					<?php include _include(APP_PATH.'view/htm/comment_list.inc.htm'); ?>

                    <!-- 判断主题是否开启评论,与最下面有一处对应 -->
					<?php if(!empty($user) && 0 == $thread['closed']) { ?>
					<li class="row post newpost media">
                        <div class="col-lg-12 d-flex justify-content-between small text-muted">
                            <!--{hook read_comment_post_start.htm}-->
                            <div>

                                <!-- 评论头像 -->
                                <a href="<?php echo url('user-'.$user['uid']);?>" tabindex="-1">
                                <img class="avatar-1 mr-2" src="<?php echo $user['avatar_url'];?>">
                                </a>

                                <!-- 评论用户名 -->
                                <span><?php echo $user['username'];?></span>

                            </div>
                            <div>

                                <!-- 评论楼层 -->
                                <span class="floor" id="newfloor">
                                    <?php echo ($thread['posts'] + 2);?>
                                </span>
                                <?php echo lang('floor');?>

                            </div>

                        </div>

                        <!-- 评论框开始 -->
                        <div class="col-lg-12">

                            <!-- 评论表单 quick_reply_form 不要随意修改 -->
                            <form action="<?php echo url('comment-create-'.$tid);?>" method="post" id="quick_reply_form" class="d-block">
                                <!-- 此处原样复制 -->
                                <input type="hidden" name="doctype" value="1" />
                                <input type="hidden" name="return_html" value="1" />
                                <input type="hidden" name="quotepid" value="0" />

                                <!-- 评论框不要随意删减,message 与下面 js 有对应 -->
                                <div class="message mt-1">
                                    <textarea class="form-control" placeholder="<?php echo lang('message');?>" name="message" id="message"></textarea>
                                </div>

                                <div class="d-flex justify-content-around text-muted mt-2 small">

                                    <!-- 提交按钮 -->
                                    <button type="submit" class="btn btn-sm btn-secondary" id="submit" data-loading-text="<?php echo lang('submiting');?>...">
                                        <?php echo lang('reply');?>
                                    </button>

                                    <?php if(2 == array_value($forum, 'comment', 0)) { ?>
                                    <a class="icon-mail-forward text-muted" href="<?php echo url('comment-create-'.$tid);?>" id="advanced_reply"><?php echo lang('advanced_reply');?></a>
                                    <?php } ?>
                                </div>

                                <!-- 表单闭合 -->
                            </form>

                        </div>
                        <!-- 评论框结束 -->
					</li>
					<?php } ?>
				</ul>
			</div>
		</div>

        <!-- 评论分页 -->
        <?php if($pagination) { ?>
        <nav>
            <ul class="pagination my-4 justify-content-center flex-wrap">
                <?php echo $pagination; ?>
            </ul>
        </nav>
        <?php }?>

        <?php } ?> <!-- 评论结束闭合 -->
 

详情页自定义标签调用跟列表页相同,此处就不在贴代码

 

加载页头和页脚,然后在最下面加载 view/htm/read.htm 文件最下面的 js 代码,有文字标注,无需修改。

最新回复(0)