last news as last topic

Current Version: 1.0.6
Released: 09.01.10
Forum rules
Before creating a new support thread, please take a look in the board3 Portal FAQ and use the search!
Many questions have already been answered.
Locked

Topic author
Weltall
Active Member
Posts: 18
Joined: 19. April 2010 20:45
phpBB.com User: Weltall

last news as last topic

Post by Weltall »

Your Portal Version: 1.0.5RC3
Your phpBB Type: Standard phpBB3
MODs installed: Yes
Your knowledge: Beginner
Boardlink: http://clandecima.altervista.org/forum/portal.php

PHP Version: 3.0.6

What have you done before the problem was there?
nothing

What have you already tryed to solve the problem?
read description

Description and Message
Hi,
This is easy to understand and difficult to explain so let me be clear.
On my portal page,I'd like to have a "news block" that displays post taken from "news forum".I can do this simply using the news panel in ACP.
The problem is that I'd like to have also a "last active topic block" displayed as if it is a news compact blocks,so i can see last 5 active topics sorted by the one with the newest post.
So i created a new custom block,called last_post,and copied the code from news_compact.In this way I have 2 news blocks as i requested but since they must be showed with different options,it become a little messy. (The news block must show fully one post while the last topic block must show 5 last topics in compact mode)

I think I have to delete some <--IF things in my last_post custom block,in a way that he display only the options i want it to have,so the ACP will set only the news block


My last_post block code:

Code: Select all

<!--version $Id: news_compact.html 503 2009-04-20 18:34:29Z kevin74 $ //-->
<div id="pagecontent">
<!-- BEGIN news_row -->
<!-- IF news_row.S_FIRST_ROW -->
{$C_BLOCK_H_L}Ultimi Argomenti Attivi{$C_BLOCK_H_R}
<table class="tablebg" cellspacing="1" width="100%">
	<!-- IF not news_row.S_NO_TOPICS  -->
		<tr class="nav">
			<!-- IF S_TOPIC_ICONS -->
				<td class="cat" align="center" colspan="3">&nbsp;{L_TOPICS}&nbsp;</td>
			<!-- ELSE -->
				<td class="cat" align="center" colspan="2">&nbsp;{L_TOPICS}&nbsp;</td>
			<!-- ENDIF -->
			<!-- IF S_DISPLAY_NEWS_RVS -->
			<td class="cat" align="center">&nbsp;{L_REPLIES}&nbsp;</td>
			<td class="cat" align="center">&nbsp;{L_VIEWS}&nbsp;</td>
			<!-- ENDIF -->
			<td class="cat" align="center">&nbsp;{L_LAST_POST}&nbsp;</td>
		</tr>
	<!-- ENDIF -->
<!-- ENDIF -->
	<!-- IF news_row.S_NO_TOPICS  -->
	<tr class="row1">
		<td align="center">
			<span class="gensmall"><strong>{L_NO_NEWS}</strong></span>
		</td>
	</tr>
	<!-- ELSE -->
			<tr>
				<td class="row1" width="25" align="center">{news_row.TOPIC_FOLDER_IMG}</td>
					<!-- IF S_TOPIC_ICONS --><td class="row1" width="25" align="center"><!-- IF news_row.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{news_row.TOPIC_ICON_IMG}" width="{news_row.TOPIC_ICON_IMG_WIDTH}" height="{news_row.TOPIC_ICON_IMG_HEIGHT}" alt="" title="" /><!-- ENDIF --></td><!-- ENDIF -->
				<td class="row1">
				<!-- IF news_row.PAGINATION --><span style="float: right; font-size:0.9em;"> [ {GOTO_PAGE_IMG}{L_GOTO_PAGE}: {news_row.PAGINATION} ] </span><!-- ENDIF -->
					{news_row.ATTACH_ICON_IMG} <!-- IF news_row.S_POLL --> <strong style="font-size:1.1em;">{L_POLL}: </strong><!-- ENDIF --><a title="{news_row.TITLE}" href="{news_row.U_VIEW_COMMENTS}" class="topictitle">{news_row.TITLE}</a>
					<p class="gensmall">{L_POSTED} {L_POST_BY_AUTHOR} {news_row.POSTER_FULL} &raquo; {news_row.TIME}
					<!-- IF news_row.FORUM_NAME -->
						<br />{L_FORUM}: <a href="{news_row.U_VIEWFORUM}" style="font-weight: bold;">{news_row.FORUM_NAME}</a>
					<!-- ENDIF -->
					<!-- IF not S_DISPLAY_NEWS_RVS --><!-- IF news_row.FORUM_NAME -->&bull; <!-- ENDIF -->{L_REPLIES}: <strong>{news_row.REPLIES}</strong>  &bull; {L_VIEWS}: <strong>{news_row.TOPIC_VIEWS}</strong><!-- ENDIF -->
					</p>
				</td>
				<!-- IF S_DISPLAY_NEWS_RVS -->
				<td class="row1" width="50" align="center"><p class="topicdetails">{news_row.REPLIES}</p></td>
				<td class="row2" width="50" align="center"><p class="topicdetails">{news_row.TOPIC_VIEWS}</p></td>
				<!-- ENDIF -->
				<td class="row1" width="140" align="center">
					<p class="topicdetails" style="white-space: nowrap;"> {news_row.LAST_POST_TIME}</p>
					<p class="topicdetails">{news_row.USERNAME_FULL_LAST}
						<!-- IF not S_IS_BOT --><!-- IF news_row.S_UNREAD_INFO --><a href="{news_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{news_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --><!-- ENDIF -->
					</p>
				</td>		
			</tr>
	<!-- ENDIF -->
<!-- IF news_row.S_LAST_ROW -->
	<!-- IF NP_PAGINATION or TOTAL_NEWS -->
	<tr class="row<!-- IF news_row.S_ROW_COUNT is even -->2<!-- ELSE -->1<!-- ENDIF -->">
		<td class="gensmall" valign="middle" align="right" nowrap="nowrap" colspan="<!-- IF S_TOPIC_ICONS and S_DISPLAY_NEWS_RVS -->6<!-- ELSEIF not S_TOPIC_ICONS and S_DISPLAY_NEWS_RVS -->5<!-- ELSEIF S_TOPIC_ICONS and not S_DISPLAY_NEWS_RVS -->4<!-- ELSE -->3<!-- ENDIF -->">{TOTAL_NEWS}
		<!-- IF NP_PAGE_NUMBER --><!-- IF NP_PAGINATION --> &bull; {NP_PAGE_NUMBER} &bull; <span>{NP_PAGINATION}</span><!-- ELSE --> &bull; {NP_PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF --></td>
	</tr>
	<!-- ENDIF -->
</table>
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
<!-- ENDIF -->
<!-- END news_row -->
</div>
[/i]

Topic author
Weltall
Active Member
Posts: 18
Joined: 19. April 2010 20:45
phpBB.com User: Weltall

Re: last news as last topic

Post by Weltall »

no one can help me?

Topic author
Weltall
Active Member
Posts: 18
Joined: 19. April 2010 20:45
phpBB.com User: Weltall

Re: last news as last topic

Post by Weltall »

up
User avatar

Marc
Dev
Posts: 2504
Joined: 17. July 2008 21:08
phpBB.de User: marc1706
phpBB.com User: Marc
Location: Clausthal-Zellerfeld / München
Contact:

Re: last news as last topic

Post by Marc »

You will also have to create a your own new version of the news block in the portal/block/ folder. For example, copy news.php and change this twice:
Find:

Code: Select all

$template->assign_block_vars('news_row', array( 
Replace with:

Code: Select all

$template->assign_block_vars('last_post_row', array( 
Then include that new block file (i.e. last_post.php) in additional_blocks.php:

Code: Select all

include($phpbb_root_path . 'portal/block/last_post.' . $phpEx); 
Now just replace all occurences of this:

Code: Select all

news_row
With this:

Code: Select all

last_post_row

Topic author
Weltall
Active Member
Posts: 18
Joined: 19. April 2010 20:45
phpBB.com User: Weltall

Re: last news as last topic

Post by Weltall »

Thanks for the answer!
Ok i did everything u said,but on portal page it shows me 2 full news block,while i'd like to have 1 full news block and 1 compact news block (last_post block).I think also in this way changes i do in the adm cp also affects the other block.

Let's put it more simple: is there any way to duplicate the news function in the adm cp? in this way i can configure them separately.
For example i can have news.php and news2.php,news_block.html and news2_block.html etc.etc. the main problem is to show em in the acp nad make sure that changes for news.php does not affect news2.php
User avatar

Marc
Dev
Posts: 2504
Joined: 17. July 2008 21:08
phpBB.de User: marc1706
phpBB.com User: Marc
Location: Clausthal-Zellerfeld / München
Contact:

Re: last news as last topic

Post by Marc »

You have to use the code of styles/prosilver/template/portal/block/news_compact.html for your new block.

Topic author
Weltall
Active Member
Posts: 18
Joined: 19. April 2010 20:45
phpBB.com User: Weltall

Re: last news as last topic

Post by Weltall »

Yes i did,and i checked again,it keep show me 2 full news block.
If i edit in the adm cp the news tab and set to compact mode i see only 1 news block in compact mode.
User avatar

Marc
Dev
Posts: 2504
Joined: 17. July 2008 21:08
phpBB.de User: marc1706
phpBB.com User: Marc
Location: Clausthal-Zellerfeld / München
Contact:

Re: last news as last topic

Post by Marc »

And where did you include your new block?

Topic author
Weltall
Active Member
Posts: 18
Joined: 19. April 2010 20:45
phpBB.com User: Weltall

Re: last news as last topic

Post by Weltall »

in portal_center.html

my additional block.php

Code: Select all

<?php

/**
*
* @package - Board3portal
* @version $Id: additional_blocks.php 523 2009-08-27 21:41:08Z christian_n $
* @copyright (c) kevin / saint ( www.board3.de/ ), (c) Ice, (c) nickvergessen ( www.flying-bits.org/ ), (c) redbull254 ( www.digitalfotografie-foren.de ), (c) Christian_N ( www.phpbb-projekt.de )
* @based on: phpBB3 Portal by Sevdin Filiz, www.phpbb3portal.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
   exit;
}

include($phpbb_root_path . 'portal/block/last_post.' . $phpEx); 

?>
my last_post.php

Code: Select all

<?php

/**
*
* @package - Board3portal
* @version $Id: news.php 588 2009-12-04 17:16:46Z marc1706 $
* @copyright (c) kevin / saint ( www.board3.de/ ), (c) Ice, (c) nickvergessen ( www.flying-bits.org/ ), (c) redbull254 ( www.digitalfotografie-foren.de ), (c) Christian_N ( www.phpbb-projekt.de )
* @based on: phpBB3 Portal by Sevdin Filiz, www.phpbb3portal.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
   exit;
}

$news = request_var('news', -1);
$news = ($news > $portal_config['portal_news_length'] -1) ? -1 : $news;
$user->add_lang('viewforum');
$start = request_var('np', 0);
$start = ($start < 0) ? 0 : $start;

// Fetch news from portal/includes/functions.php with check if "read full" is requested.
$portal_news_length = ($news < 0) ? $portal_config['portal_news_length'] : 0;
$fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_config['portal_news_permissions'], $portal_config['portal_number_of_news'], $portal_news_length, 0, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news', $start, $portal_config['portal_news_exclude']);


// Any news present? If not terminate it here.
if (sizeof($fetch_news) == 0)
{
	$template->assign_block_vars('news_row', array(
		'S_NO_TOPICS'	=> true,
		'S_NOT_LAST'	=> false,
	));
}
else
{
	// Count number of posts for news archive, considering if permission check is dis- or enabled.
	if ($portal_config['portal_news_archive'])
	{
		$permissions = $portal_config['portal_news_permissions'];
		$forum_from = $portal_config['portal_news_forum'];

		$forum_from = (strpos($forum_from, ',') !== false) ? explode(',', $forum_from) : (($forum_from != '') ? array($forum_from) : array());

		$str_where = '';

		if($permissions == true)
		{
			$disallow_access = array_unique(array_keys($auth->acl_getf('!f_read', true)));
		}
		else
		{
			$disallow_access = array();
		}
		
		if($portal_config['portal_news_exclude'] == true)
		{
			$disallow_access = array_merge($disallow_access, $forum_from);
			$forum_from = array();
		}

		if(sizeof($forum_from))
		{
			$disallow_access = array_diff($forum_from, $disallow_access);
			if(!sizeof($disallow_access))
			{
				return array();
			}

			foreach($disallow_access as $acc_id)
			{
				$acc_id = (int) $acc_id;
				$str_where .= "forum_id = $acc_id OR ";
			}
		}
		else
		{
			foreach($disallow_access as $acc_id)
			{
				$acc_id = (int) $acc_id;
				$str_where .= "forum_id <> $acc_id AND ";
			}
		}

		$str_where = (strlen($str_where) > 0) ? 'AND (' . trim(substr($str_where, 0, -4)) . ')' : '';

		$topic_type = ($portal_config['portal_show_all_news']) ? '(topic_type <> ' . POST_ANNOUNCE . ') AND (topic_type <> ' . POST_GLOBAL . ')' : 'topic_type = ' . POST_NORMAL;

		$sql = 'SELECT COUNT(topic_id) AS num_topics
			FROM ' . TOPICS_TABLE . '
			WHERE ' . $topic_type . '
				AND topic_approved = 1
				AND topic_moved_id = 0
				' . $str_where;
			$result = $db->sql_query($sql);
			$total_news = (int) $db->sql_fetchfield('num_topics');
			$db->sql_freeresult($result);
	}

	if($news < 0)
	// Show the news overview
	{
		$count = $fetch_news['topic_count'];
		for ($i = 0; $i < $count; $i++)
		{
			if(isset($fetch_news[$i]['striped']) && $fetch_news[$i]['striped'] == true)
			{
				$open_bracket = '[ ';
				$close_bracket = ' ]';
				$read_full = $user->lang['READ_FULL'];
			}
			else
			{
				$open_bracket = '';
				$close_bracket = '';
				$read_full = '';
			}
			// unread?
			$forum_id = $fetch_news[$i]['forum_id'];
			$topic_id = $fetch_news[$i]['topic_id'];
			$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id, $global_announce_list = false);
			$unread_topic = (isset($topic_tracking_info[$topic_id]) && $fetch_news[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
			
			$read_full_url = (isset($_GET['np'])) ? 'np='. $start . '&news=' . $i . '#n' . $i : 'news=' . $i . '#n' . $i;
			$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($fetch_news[$i]['forum_id']) ? $fetch_news[$i]['forum_id'] : $forum_id) . '&t=' . $topic_id);
			if ($portal_config['portal_news_archive'])
			{
				$pagination = generate_portal_pagination(append_sid("{$phpbb_root_path}portal.$phpEx"), $total_news, $portal_config['portal_number_of_news'], $start, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news');
			}

			$replies = ($auth->acl_get('m_approve', $forum_id)) ? $fetch_news[$i]['topic_replies_real'] : $fetch_news[$i]['topic_replies'];
			$folder_img = $folder_alt = $topic_type = $folder = $folder_new = '';
			switch ($fetch_news[$i]['topic_type'])
			{
				case POST_STICKY:
					$folder = 'sticky_read';
					$folder_new = 'sticky_unread';
				break;
				case POST_ANNOUNCE:
					$folder = 'announce_read';
					$folder_new = 'announce_unread';
				break;
				default:
					$folder = 'topic_read';
					$folder_new = 'topic_unread';
					if ($config['hot_threshold'] && $replies >= $config['hot_threshold'] && $fetch_news[$i]['topic_status'] != ITEM_LOCKED)
					{
						$folder .= '_hot';
						$folder_new .= '_hot';
					}
				break;
			}

			if ($fetch_news[$i]['topic_status'] == ITEM_LOCKED)
			{
				$folder .= '_locked';
				$folder_new .= '_locked';
			}
			if ($fetch_news[$i]['topic_posted'])
			{
				$folder .= '_mine';
				$folder_new .= '_mine';
			}

			$folder_img = ($unread_topic) ? $folder_new : $folder;
			$folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($fetch_news[$i]['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS');

			// Grab icons
			$icons = $cache->obtain_icons();

			$template->assign_block_vars('news_row', array(
				'ATTACH_ICON_IMG'		=> ($fetch_news[$i]['attachment'] && $config['allow_attachments']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
				'FORUM_NAME'			=> ($forum_id) ? $fetch_news[$i]['forum_name'] : '',
				'TITLE'					=> $fetch_news[$i]['topic_title'],
				'POSTER'				=> $fetch_news[$i]['username'],
				'POSTER_FULL'			=> $fetch_news[$i]['username_full'],
				'USERNAME_FULL_LAST'	=> $fetch_news[$i]['username_full_last'],	
				'U_USER_PROFILE'		=> (($fetch_news[$i]['user_type'] == USER_NORMAL || $fetch_news[$i]['user_type'] == USER_FOUNDER) && $fetch_news[$i]['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $fetch_news[$i]['user_id']) : '',
				'TIME'					=> $fetch_news[$i]['topic_time'],
				'LAST_POST_TIME'		=> $user->format_date($fetch_news[$i]['topic_last_post_time']),
				'TEXT'					=> $fetch_news[$i]['post_text'],
				'REPLIES'				=> $fetch_news[$i]['topic_replies'],
				'TOPIC_VIEWS'			=> $fetch_news[$i]['topic_views'],
				'N_ID'					=> $i,
				'TOPIC_FOLDER_IMG'		=> $user->img($folder_img, $folder_alt),
				'TOPIC_FOLDER_IMG_SRC'  => $user->img($folder_img, $folder_alt, false, '', 'src'),
				'TOPIC_FOLDER_IMG_ALT'  => $user->lang[$folder_alt],
				'TOPIC_ICON_IMG'		=> (!empty($icons[$fetch_news[$i]['icon_id']])) ? $icons[$fetch_news[$i]['icon_id']]['img'] : '',
				'TOPIC_ICON_IMG_WIDTH'	=> (!empty($icons[$fetch_news[$i]['icon_id']])) ? $icons[$fetch_news[$i]['icon_id']]['width'] : '',
				'TOPIC_ICON_IMG_HEIGHT'	=> (!empty($icons[$fetch_news[$i]['icon_id']])) ? $icons[$fetch_news[$i]['icon_id']]['height'] : '',
				'FOLDER_IMG'			=> $user->img('topic_read', 'NO_NEW_POSTS'),
				'U_VIEWFORUM'			=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $fetch_news[$i]['forum_id']),
				'U_LAST_COMMENTS'		=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news[$i]['forum_id'] . '&t=' . $fetch_news[$i]['topic_id'] . '&p=' . $fetch_news[$i]['topic_last_post_id'] . '#p' . $fetch_news[$i]['topic_last_post_id']),
				'U_VIEW_COMMENTS'		=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news[$i]['forum_id'] . '&t=' . $fetch_news[$i]['topic_id']),
				'U_VIEW_UNREAD'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news[$i]['forum_id'] . '&t=' . $fetch_news[$i]['topic_id'] . '&view=unread#unread'),
				'U_POST_COMMENT'		=> append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=reply&f=' . $fetch_news[$i]['forum_id'] . '&t=' . $fetch_news[$i]['topic_id']),
				'U_READ_FULL'			=> append_sid("{$phpbb_root_path}portal.$phpEx", $read_full_url),
				'L_READ_FULL'			=> $read_full,
				'OPEN'					=> $open_bracket,
				'CLOSE'					=> $close_bracket,
				'S_NOT_LAST'			=> ($i < sizeof($fetch_news) - 1) ? true : false,
				'S_POLL'				=> $fetch_news[$i]['poll'],
				'S_UNREAD_INFO'			=> $unread_topic,
				'PAGINATION'			=> topic_generate_pagination($fetch_news[$i]['topic_replies'], $view_topic_url),
				'S_HAS_ATTACHMENTS'		=> (!empty($fetch_news[$i]['attachments'])) ? true : false,
			));

			if(!empty($fetch_news[$i]['attachments']))
			{
				foreach ($fetch_news[$i]['attachments'] as $attachment)
				{
					$template->assign_block_vars('news_row.attachment', array(
						'DISPLAY_ATTACHMENT'	=> $attachment)
					);
				}
			}

			if ($portal_config['portal_number_of_news'] <> 0 && $portal_config['portal_news_archive'])
			{
				$template->assign_vars(array(
					'NP_PAGINATION'		=> $pagination,
					'TOTAL_NEWS'		=> ($total_news == 1) ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $total_news),
					'NP_PAGE_NUMBER'	=> on_page($total_news, $portal_config['portal_number_of_news'], $start))
				);
			}
		}
	}
	else
	// Show "read full" page
	{
		$i = $news;
		$forum_id = $fetch_news[$i]['forum_id'];
		$topic_id = $fetch_news[$i]['topic_id'];
		$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id, $global_announce_list = false);
		$unread_topic = (isset($topic_tracking_info[$topic_id]) && $fetch_news[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
		$open_bracket = '[ ';
		$close_bracket = ' ]';
		$read_full = $user->lang['BACK'];
				
		$read_full_url = (isset($_GET['np'])) ? append_sid("{$phpbb_root_path}portal.$phpEx", "np=$start#n$i") : append_sid("{$phpbb_root_path}portal.$phpEx#n$i");
		$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . (($fetch_news[$i]['forum_id']) ? $fetch_news[$i]['forum_id'] : $forum_id) . '&t=' . $topic_id);
		if ($portal_config['portal_news_archive'])
		{
			$pagination = generate_portal_pagination(append_sid("{$phpbb_root_path}portal.$phpEx"), $total_news, $portal_config['portal_number_of_news'], $start, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news');
		}

		$template->assign_block_vars('news_row', array(
			'ATTACH_ICON_IMG'	=> ($fetch_news[$i]['attachment'] && $config['allow_attachments']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
			'FORUM_NAME'		=> ($forum_id) ? $fetch_news[$i]['forum_name'] : '',
			'TITLE'				=> $fetch_news[$i]['topic_title'],
			'POSTER'			=> $fetch_news[$i]['username'],
			'POSTER_FULL'		=> $fetch_news[$i]['username_full'],
			'TIME'				=> $fetch_news[$i]['topic_time'],
			'TEXT'				=> $fetch_news[$i]['post_text'],
			'REPLIES'			=> $fetch_news[$i]['topic_replies'],
			'TOPIC_VIEWS'		=> $fetch_news[$i]['topic_views'],
			'N_ID'				=> $i,
			'U_VIEWFORUM'		=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $fetch_news[$i]['forum_id']),
			'U_LAST_COMMENTS'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $fetch_news[$i]['topic_last_post_id'] . '#p' . $fetch_news[$i]['topic_last_post_id']),
			'U_VIEW_COMMENTS'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news[$i]['forum_id'] . '&t=' . $fetch_news[$i]['topic_id']),
			'U_POST_COMMENT'	=> append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=reply&f=' . $fetch_news[$i]['forum_id'] . '&t=' . $fetch_news[$i]['topic_id']),
			'S_POLL'			=> $fetch_news[$i]['poll'],
			'S_UNREAD_INFO'		=> $unread_topic,
			'U_READ_FULL'		=> $read_full_url,
			'L_READ_FULL'		=> $read_full,      
			'OPEN'				=> $open_bracket,
			'CLOSE'				=> $close_bracket,
			'PAGINATION'		=> topic_generate_pagination($fetch_news[$i]['topic_replies'], $view_topic_url),
			'S_HAS_ATTACHMENTS'	=> (!empty($fetch_news[$i]['attachments'])) ? true : false,
		));

		if(!empty($fetch_news[$i]['attachments']))
		{
			foreach ($fetch_news[$i]['attachments'] as $attachment)
			{
				$template->assign_block_vars('news_row.attachment', array(
					'DISPLAY_ATTACHMENT'	=> $attachment)
				);
			}
		}

		if ($portal_config['portal_number_of_news'] <> 0 && $portal_config['portal_news_archive'])
		{
			$template->assign_vars(array(
				'NP_PAGINATION'		=> $pagination,
				'TOTAL_NEWS'		=> ($total_news == 1) ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $total_news),
				'NP_PAGE_NUMBER'	=> on_page($total_news, $portal_config['portal_number_of_news'], $start))
			);
		}
	}
}

$topic_icons = false;
if(!empty($fetch_news['topic_icons']))
{
	$topic_icons = true;
}

$template->assign_vars(array(
	'NEWEST_POST_IMG'			=> $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
	'READ_POST_IMG'				=> $user->img('icon_topic_latest', 'VIEW_LATEST_POST'),
	'GOTO_PAGE_IMG'				=> $user->img('icon_post_target', 'GOTO_PAGE'),
	'S_NEWEST_OR_FIRST'			=> ($portal_config['portal_news_show_last']) ? $user->lang['JUMP_NEWEST'] : $user->lang['JUMP_FIRST'],
	'POSTED_BY_TEXT'			=> ($portal_config['portal_news_show_last']) ? $user->lang['LAST_POST'] : $user->lang['POSTED'],
	'S_DISPLAY_NEWS'			=> true,
	'S_DISPLAY_NEWS_RVS'		=> ($portal_config['portal_show_news_replies_views']) ? true : false,
	'S_TOPIC_ICONS'				=> $topic_icons,
));

?>
my last_post.html

Code: Select all

<!--version $Id: news_compact.html 503 2009-04-20 18:34:29Z kevin74 $ //-->
<div id="pagecontent">
<!-- BEGIN last_post_row -->
<!-- IF last_post_row.S_FIRST_ROW -->
{$C_BLOCK_H_L}Ultimi Argomenti Attivi{$C_BLOCK_H_R}
<table class="tablebg" cellspacing="1" width="100%">
	<!-- IF not last_post_row.S_NO_TOPICS  -->
		<tr class="nav">
			<!-- IF S_TOPIC_ICONS -->
				<td class="cat" align="center" colspan="3">&nbsp;{L_TOPICS}&nbsp;</td>
			<!-- ELSE -->
				<td class="cat" align="center" colspan="2">&nbsp;{L_TOPICS}&nbsp;</td>
			<!-- ENDIF -->
			<!-- IF S_DISPLAY_NEWS_RVS -->
			<td class="cat" align="center">&nbsp;{L_REPLIES}&nbsp;</td>
			<td class="cat" align="center">&nbsp;{L_VIEWS}&nbsp;</td>
			<!-- ENDIF -->
			<td class="cat" align="center">&nbsp;{L_LAST_POST}&nbsp;</td>
		</tr>
	<!-- ENDIF -->
<!-- ENDIF -->
	<!-- IF last_post_row.S_NO_TOPICS  -->
	<tr class="row1">
		<td align="center">
			<span class="gensmall"><strong>{L_NO_NEWS}</strong></span>
		</td>
	</tr>
	<!-- ELSE -->
			<tr>
				<td class="row1" width="25" align="center">{last_post_row.TOPIC_FOLDER_IMG}</td>
					<!-- IF S_TOPIC_ICONS --><td class="row1" width="25" align="center"><!-- IF last_post_row.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{last_post_row.TOPIC_ICON_IMG}" width="{last_post_row.TOPIC_ICON_IMG_WIDTH}" height="{last_post_row.TOPIC_ICON_IMG_HEIGHT}" alt="" title="" /><!-- ENDIF --></td><!-- ENDIF -->
				<td class="row1">
				<!-- IF last_post_row.PAGINATION --><span style="float: right; font-size:0.9em;"> [ {GOTO_PAGE_IMG}{L_GOTO_PAGE}: {last_post_row.PAGINATION} ] </span><!-- ENDIF -->
					{last_post_row.ATTACH_ICON_IMG} <!-- IF last_post_row.S_POLL --> <strong style="font-size:1.1em;">{L_POLL}: </strong><!-- ENDIF --><a title="{last_post_row.TITLE}" href="{last_post_row.U_VIEW_COMMENTS}" class="topictitle">{last_post_row.TITLE}</a>
					<p class="gensmall">{L_POSTED} {L_POST_BY_AUTHOR} {last_post_row.POSTER_FULL} &raquo; {last_post_row.TIME}
					<!-- IF last_post_row.FORUM_NAME -->
						<br />{L_FORUM}: <a href="{last_post_row.U_VIEWFORUM}" style="font-weight: bold;">{last_post_row.FORUM_NAME}</a>
					<!-- ENDIF -->
					<!-- IF not S_DISPLAY_NEWS_RVS --><!-- IF last_post_row.FORUM_NAME -->&bull; <!-- ENDIF -->{L_REPLIES}: <strong>{last_post_row.REPLIES}</strong>  &bull; {L_VIEWS}: <strong>{last_post_row.TOPIC_VIEWS}</strong><!-- ENDIF -->
					</p>
				</td>
				<!-- IF S_DISPLAY_NEWS_RVS -->
				<td class="row1" width="50" align="center"><p class="topicdetails">{last_post_row.REPLIES}</p></td>
				<td class="row2" width="50" align="center"><p class="topicdetails">{last_post_row.TOPIC_VIEWS}</p></td>
				<!-- ENDIF -->
				<td class="row1" width="140" align="center">
					<p class="topicdetails" style="white-space: nowrap;"> {last_post_row.LAST_POST_TIME}</p>
					<p class="topicdetails">{last_post_row.USERNAME_FULL_LAST}
						<!-- IF not S_IS_BOT --><!-- IF last_post_row.S_UNREAD_INFO --><a href="{last_post_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{last_post_row.U_LAST_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --><!-- ENDIF -->
					</p>
				</td>		
			</tr>
	<!-- ENDIF -->
<!-- IF last_post_row.S_LAST_ROW -->
	<!-- IF NP_PAGINATION or TOTAL_NEWS -->
	<tr class="row<!-- IF last_post_row.S_ROW_COUNT is even -->2<!-- ELSE -->1<!-- ENDIF -->">
		<td class="gensmall" valign="middle" align="right" nowrap="nowrap" colspan="<!-- IF S_TOPIC_ICONS and S_DISPLAY_NEWS_RVS -->6<!-- ELSEIF not S_TOPIC_ICONS and S_DISPLAY_NEWS_RVS -->5<!-- ELSEIF S_TOPIC_ICONS and not S_DISPLAY_NEWS_RVS -->4<!-- ELSE -->3<!-- ENDIF -->">{TOTAL_NEWS}
		<!-- IF NP_PAGE_NUMBER --><!-- IF NP_PAGINATION --> &bull; {NP_PAGE_NUMBER} &bull; <span>{NP_PAGINATION}</span><!-- ELSE --> &bull; {NP_PAGE_NUMBER}<!-- ENDIF --><!-- ENDIF --></td>
	</tr>
	<!-- ENDIF -->
</table>
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
<!-- ENDIF -->
<!-- END last_post_row -->
</div>

Topic author
Weltall
Active Member
Posts: 18
Joined: 19. April 2010 20:45
phpBB.com User: Weltall

Re: last news as last topic

Post by Weltall »

is there no way to have 2 editable from adm cp news block?
Locked

Return to “board3 Portal 1.0.x - English Support”