论坛前台公告的处理程序是在,./source/forum/forum_index.php中处理的,代码如下: - $announcements = get_index_announcements();
复制代码如果,没有分区id和页面缓存的情况下,就重新读取一遍论坛公告。
获取函数为get_index_announcements(); - function get_index_announcements() {
- global $_G;
- $announcements = '';
- if($_G['cache']['announcements']) {
- $readapmids = !empty($_G['cookie']['readapmid']) ? explode('D', $_G['cookie']['readapmid']) : array();
- foreach($_G['cache']['announcements'] as $announcement) {
- if(!$announcement['endtime'] || $announcement['endtime'] > TIMESTAMP && (empty($announcement['groups']) || in_array($_G['member']['groupid'], $announcement['groups']))) {
- if(empty($announcement['type'])) {
- $announcements .= '<li><span><a href="forum.php?mod=announcement&id='.$announcement['id'].'" target="_blank" class="xi2">'.$announcement['subject'].
- '</a></span><em>('.dgmdate($announcement['starttime'], 'd').')</em></li>';
- } elseif($announcement['type'] == 1) {
- $announcements .= '<li><span><a href="'.$announcement['message'].'" target="_blank" class="xi2">'.$announcement['subject'].
- '</a></span><em>('.dgmdate($announcement['starttime'], 'd').')</em></li>';
- }
- }
- }
- }
- return $announcements;
- }
复制代码这段代码即使论坛公告的获取和处理代码,这里通过对公告时间和用户组权限的判断取出缓存当中的公告,并对不同类型的公告做了处理 1. 文字公告没有type值 2. 网址链接的type值等于1,做了链接处理! 我们如果需要修改论坛公告展示代码的展示样式可以通过修改这段代码完成,默认的是封装在<li>标签中的。 前台的展示代码在文件./template/deault/forum/discus.htm - <!--{if empty($gid) && $announcements}-->
- <div class="y">
- <div id="an">
- <dl class="cl">
- <dt class="z xw1">{lang announcements}: </dt>
- <dd>
- <div id="anc"><ul id="ancl">$announcements</ul></div>
- </dd>
- </dl>
- </div>
- <script type="text/javascript">announcement();</script>
- </div>
- <!--{/if}-->
复制代码注意公告上下轮换的js效果是<scripttype="text/javascript">announcement();</script> 这段js控制的。如果你想对他的js动态展示效果做些处理的话到这个文件./static/js/forum.js中修改即可!
|