【分享】文章列表显示图片列表的修改方法
1、找到:app\article\main.php 在文件里搜索,导航的上一段,对比改成:(注意,加粗是新增的;)
if ($article_list) { foreach ($article_list AS $key => $val) { $article_ids = $val['id']; $article_uids[$val['uid']] = $val['uid']; } $article_topics = $this->model('topic')->get_topics_by_item_ids($article_ids, 'article'); $article_users_info = $this->model('account')->get_user_info_by_uids($article_uids); $article_attachs = $this->model('publish')->get_attachs('article', $article_ids, 'min');//这里新增 foreach ($article_list AS $key => $val) { $article_list[$key]['user_info'] = $article_users_info[$val['uid']]; if ($val['has_attach'])//这里新增 { $article_list[$key]['attachs'] = $article_attachs[$val['id']]; } } }2、在模板文件里:views\default\article\square.tpl.htm 搜索 <div class="hide-content markitup-box"> 下一段加,如下
<div class="hide-content markitup-box"> <?php echo FORMAT::parse_attachs(nl2br(FORMAT::parse_markdown($val['message']))); ?> </div> 以下新增 <?php if ($val['attachs']) { ?> <div class="aw-upload-img-list width-auto" style="margin-top:15px;"> <?php foreach($val['attachs'] AS $attach) { ?> <a href="<?php echo $attach['attachment']; ?>" target="_blank" data-fancybox-group="thumb" rel="lightbox"> <img class="img-thumbnail" style="margin-bottom:15px;" src="<?php echo $attach[thumb]; ?>" alt="<?php echo $attach['file_name']; ?>" /> </a> <?php } ?> </div> <?php } ?>用的好得加分,以后还会有好东西分享! 演示:http://techan.xwmm.com/?/article/ 注意要对应修改。
2015-02-11 10:17
2015-01-23 14:36
2015-01-08 14:35
2015-01-08 14:35
2015-01-08 14:34
2015-01-06 16:14
2015-01-06 16:13