•  
     

global announcements on index - Editado para NV Recent Topics + phpBBSEO

HTML

Código: Selecionar todos

<!-- BEGIN topicrow -->
<!-- IF topicrow.S_FIRST_ROW -->
<tr>
<td class="row3" colspan="6"><!-- IF not S_IS_BOT --><b class="gensmall">{L_ANNOUNCEMENTS}</b><!-- ENDIF --></td>
</tr>
<!-- ENDIF -->
<tr>
<td class="row1" width="25" align="center"><!-- IF not S_IS_BOT -->{topicrow.TOPIC_FOLDER_IMG}<!-- ENDIF --></td>
<td class="row1" width="569">
<a title="{L_POSTED}: {topicrow.FIRST_POST_TIME}" href="{topicrow.TOPIC_LINK}" class="topictitle">{topicrow.TOPIC_TITLE}</a> 
</td>
<td class="row1" width="112" align="center"><!-- IF not S_IS_BOT --><p class="topicauthor">{topicrow.TOPIC_AUTHOR_FULL}</p><!-- ENDIF --></td>
<td class="row1" width="80" align="center"><!-- IF not S_IS_BOT --><p class="topicdetails">{topicrow.REPLIES}</p><!-- ENDIF --></td>
<td class="row1" width="80" align="center"><!-- IF not S_IS_BOT --><p class="topicdetails">{topicrow.VIEWS}</p><!-- ENDIF --></td>
<td class="row1" width="112" align="center"><!-- IF not S_IS_BOT -->
<p class="topicdetails">{topicrow.LAST_POST_TIME}</p>
<p class="topicsauthor">{topicrow.TOPIC_LAST_AUTHOR}
</p><!-- ENDIF -->
</td>
</tr>
<!-- IF topicrow.S_LAST_ROW -->	
<tr>
<td class="row3" colspan="6"><!-- IF not S_IS_BOT --><b class="gensmall">{L_TOPICS}</b><!-- ENDIF --></td>
</tr>
<!-- ENDIF -->
<!-- END topicrow -->


PHP

Código: Selecionar todos


// START Global Announcements
				$user->add_lang(array('memberlist', 'viewforum'));

				$sql_from = TOPICS_TABLE . ' t ';
				$sql_select = '';

				if ($config['load_db_track'])
				{
					$sql_from .= ' LEFT JOIN ' . TOPICS_POSTED_TABLE . ' tp ON (tp.topic_id = t.topic_id
						AND tp.user_id = ' . $user->data['user_id'] . ')';
					$sql_select .= ', tp.topic_posted';
				}

				if ($config['load_db_lastread'])
				{
					$sql_from .= ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id
						AND tt.user_id = ' . $user->data['user_id'] . ')';
					$sql_select .= ', tt.mark_time';
				}

				$topic_type = $user->lang['VIEW_TOPIC_GLOBAL'];
				$folder = 'global_read';
				$folder_new = 'global_unread';

				// Get cleaned up list... return only those forums not having the f_read permission
				$forum_ary = $auth->acl_getf('!f_read', true);
				$forum_ary = array_unique(array_keys($forum_ary));

				// Determine first forum the user is able to read into - for global announcement link
				$sql = 'SELECT forum_id
					FROM ' . FORUMS_TABLE . '
					WHERE forum_type = ' . FORUM_POST;

				if (sizeof($forum_ary))
				{
					$sql .= ' AND ' . $db->sql_in_set('forum_id', $forum_ary, true);
				}
				$result = $db->sql_query_limit($sql, 1);
				$g_forum_id = (int) $db->sql_fetchfield('forum_id');
				$db->sql_freeresult($result);

				$sql = "SELECT t.* $sql_select
					FROM $sql_from
					WHERE t.forum_id = 0
						AND t.topic_type = " . POST_GLOBAL . '
					ORDER BY t.topic_last_post_time DESC';

				$topic_list = $rowset = array();
				// If the user can't see any forums, he can't read any posts because fid of 0 is invalid
				if ($g_forum_id)
				{
					$result = $db->sql_query($sql);

					while ($row = $db->sql_fetchrow($result))
					{
						$topic_list[] = $row['topic_id'];
						$rowset[$row['topic_id']] = $row;
					}
					$db->sql_freeresult($result);
				}

				$topic_tracking_info = array();
				if ($config['load_db_lastread'] && $user->data['is_registered'])
				{
					$topic_tracking_info = get_topic_tracking(0, $topic_list, $rowset, false, $topic_list);
				}
				else
				{
					$topic_tracking_info = get_complete_topic_tracking(0, $topic_list, $topic_list);
				}

				foreach ($topic_list as $topic_id)
				{
					$row = &$rowset[$topic_id];

					$forum_id = $row['forum_id'];
					$topic_id = $row['topic_id'];

																			// www.phpBB-SEO.com SEO TOOLKIT BEGIN
		if (!empty($row['topic_url'])) {
			$phpbb_seo->prepare_iurl($row, 'topic', '');
		} else {
			if ($phpbb_seo->modrtype > 2) {
				$row['topic_title'] = censor_text($row['topic_title']);
			}
			$parent_forum = $row['topic_type'] == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : (!empty($phpbb_seo->seo_url['forum'][$topic_forum_id]) ? $phpbb_seo->seo_url['forum'][$topic_forum_id] : false);
			if ($parent_forum) {
				$phpbb_seo->prepare_iurl($row, 'topic', $parent_forum);
			}
		}
		// www.phpBB-SEO.com SEO TOOLKIT END
					$unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
                    // Grab icons
                    $icons = $cache->obtain_icons();

					$folder_img = ($unread_topic) ? $folder_new : $folder;
					$folder_alt = ($unread_topic) ? 'UNREAD_POSTS' : (($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_UNREAD_POSTS');
                    $topic_link = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&amp;t=' . $row['topic_id']);
                    $topic_views = $user->lang($row['topic_views']);
                    $topic_replies = $user->lang($row['topic_replies']);
                    $topic_last_author = get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']);
      
					if ($row['topic_status'] == ITEM_LOCKED)
					{
						$folder_img .= '_locked';
					}

					// Posted image?
					if (!empty($row['topic_posted']) && $row['topic_posted'])
					{
						$folder_img .= '_mine';
					}

					$template->assign_block_vars('topicrow', array(
						'FORUM_ID'					=> $forum_id,
						'TOPIC_ID'					=> $topic_id,
						'TOPIC_AUTHOR'				=> get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
						'TOPIC_AUTHOR_COLOUR'		=> get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
						'TOPIC_AUTHOR_FULL'			=> get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
						'FIRST_POST_TIME'			=> $user->format_date($row['topic_time']),
						'LAST_POST_SUBJECT'			=> censor_text($row['topic_last_post_subject']),
						'LAST_POST_TIME'			=> $user->format_date($row['topic_last_post_time']),
						'LAST_VIEW_TIME'			=> $user->format_date($row['topic_last_view_time']),
						'LAST_POST_AUTHOR'			=> get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
						'LAST_POST_AUTHOR_COLOUR'	=> get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
						'LAST_POST_AUTHOR_FULL'		=> get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
						'TOPIC_TITLE'				=> censor_text($row['topic_title']),
						'TOPIC_TYPE'				=> $topic_type,
                        'TOPIC_LINK'                => $topic_link,
	                    'REPLIES'			        => $topic_replies,
	                    'VIEWS'				        => $topic_views,
		                'TOPIC_LAST_AUTHOR'         => $topic_last_author,
						'TOPIC_FOLDER_IMG'		=> $user->img($folder_img, $folder_alt),
						'FOLDER_ANNOUNCE_IMG'		=> $user->img('announce_read', 'POST_ANNOUNCEMENT'),
						'TOPIC_FOLDER_IMG_SRC'	=> $user->img($folder_img, $folder_alt, false, '', 'src'),
                        'TOPIC_ICON_IMG'		=> (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '',
			            'TOPIC_ICON_IMG_WIDTH'	=> (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '',
			            'TOPIC_ICON_IMG_HEIGHT'	=> (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '',
			
						'S_USER_POSTED'		=> (!empty($row['topic_posted']) && $row['topic_posted']) ? true : false,
						'S_UNREAD'			=> $unread_topic,
						

						'U_TOPIC_AUTHOR'		=> get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
						'U_LAST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$g_forum_id&amp;t=$topic_id&amp;p=" . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
						'U_LAST_POST_AUTHOR'	=> get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
						'U_NEWEST_POST'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$g_forum_id&amp;t=$topic_id&amp;view=unread") . '#unread',
						'U_VIEW_TOPIC'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$g_forum_id&amp;t=$topic_id"))
					);
				}

Imagem
Download: http://www.gurubr.com/anuncios-globais- ... -t126.html
 
Legal

Obrigado pela contribuição