Tab based Latest News Block - advance skills needed!

Forum rules
This forum is not for support requests.

Only post Modifications for Board3 Portal 1.0.x in this forum.

Topic author
frold
Portal Enthusiast
Portal Enthusiast
Posts: 108
Joined: 24. March 2008 08:52

Tab based Latest News Block - advance skills needed!

Post by frold » 25. May 2008 20:09

TAB BASED LATEST NEWS BLOCK

First this block need some skills to be able to add to your forum - as this is some durty code that have to be edited by you to fit your needs

Credit:
Frold from http://studmed.dk

This block make it posible to have a block where you get in news from the forums you like. Eg. The tab "All" take all the newest posts. While the tab "Support" gives you the newest posts from forum_id 3, 4, 5. And tab "Off topic" gives you the newest post from forum_id 6 etc....

Demo: http://www.studmed.dk - See the block with the tabs "Alle", "Studmed", "Candmed"

CREATE
styles/prosilver/template/portal/block/tabnews.html

Code: Select all

<script type="text/javascript">
<!--
	var panels = new Array('tab1-panel', 'tab2-panel', 'tab3-panel', 'tab4-panel', 'tab5-panel', 'tab6-panel', 'tab7-panel');
	var show_panel = 'tab1-panel';		
//-->
</script>

<div id="tabs">
	<ul>
		<li class="activetab" id="tab1-panel-tab"><a href="#tabs" onclick="subPanels('tab1-panel'); return false;"><span>All</span></a></li>
		<li class="" id="tab2-panel-tab"><a href="#tabs" onclick="subPanels('tab2-panel'); return false;"><span>Tab 2</span></a></li>
		<li class="" id="tab3-panel-tab"><a href="#tabs" onclick="subPanels('tab3-panel'); return false;"><span>Tab 3</span></a></li>
		<li class="" id="tab4-panel-tab"><a href="#tabs" onclick="subPanels('tab4-panel'); return false;"><span>Tab 4</span></a></li>
		<li class="" id="tab5-panel-tab"><a href="#tabs" onclick="subPanels('tab5-panel'); return false;"><span>Tab 5</span></a></li>
		<li class="" id="tab6-panel-tab"><a href="#tabs" onclick="subPanels('tab6-panel'); return false;"><span>Tab 6</span></a></li>	
		<li class="" id="tab7-panel-tab"><a href="#tabs" onclick="subPanels('tab7-panel'); return false;"><span>Tab 7</span></a></li>	
	</ul>
</div>

<div class="forabg" style="margin: auto;">
	<div class="inner" style="text-align:left;">
		<span class="corners-top"><span></span></span>
		<ul class="topiclist">
			<li class="header"><dl><dt></dt></dl></li>
		</ul>
		<div class="forums" >

		<div style="display: block;" class="panel bg1" id="tab1-panel">
			<dl>
				<dd class="posts_portal"  style="border-left:0px">
				<ul class="news">
					<!-- BEGIN news_row_tab1 -->
					<!-- IF news_row_tab1.S_NO_TOPICS -->
					<li>
					<span class="gensmall" style="text-align: center; margin: 0 0 0 5px;"><strong>{L_NO_NEWS}</strong></span>
					</li>
					<!-- ELSE -->
					<li>
						<span style="float: left; margin: 0 0 0 5px;"><img src="{T_THEME_PATH}/images/arrow_right.gif" alt=""/> 
						<!-- IF news_row_tab1.S_UNREAD_INFO -->{NEWEST_POST_IMG}<!-- ELSE -->{READ_POST_IMG}<!-- ENDIF --> {news_row_tab1.ATTACH_ICON_IMG}  <!-- IF news_row_tab1.S_POLL --><strong>{L_POLL}: </strong><!-- ENDIF --><a href="{news_row_tab1.U_LAST_COMMENTS}" title="{L_JUMP_NEWEST}"><strong style="font-size:1.1em;">{news_row_tab1.TITLE}</strong></a></span>
						<span style="float: right; margin: 0 5px 0 0;">{L_LAST_POST} {L_POST_BY_AUTHOR}: <strong><a href="{news_row_tab1.U_USER_PROFILE}">{news_row_tab1.POSTER}</a></strong></span>
						<br style="clear:both" />
						<!-- IF news_row_tab1.FORUM_NAME -->
						<span style="float: left; font-size:1.0em; margin: 2px 0 0 28px;">{L_FORUM}: <strong><a href="{news_row_tab1.U_VIEWFORUM}">{news_row_tab1.FORUM_NAME}</a></strong></span>
						<!-- ENDIF -->
						<span style="float: right; margin: 0 5px 0 0;">{L_POSTED_ON_DATE} <strong>{news_row_tab1.TIME}</strong></span>
						<br style="clear:both" />
						<span style="float: left; margin: 0 0 0 28px;">
							<a href="{news_row_tab1.U_VIEW_COMMENTS}" title="{L_JUMP_FIRST}"><span style="font-size:0.9em;"><em>{L_COMMENTS}: {news_row_tab1.REPLIES}</em></span></a>
							<span style="font-size:0.9em;"><em>{L_TOPIC_VIEWS}: {news_row_tab1.TOPIC_VIEWS}</em></span>
						</span>
						<!-- IF news_row_tab1.S_NOT_LAST --><hr style="margin: 0px 0px 3px 0px;" /><!-- ENDIF -->						
					</li>
					<!-- ENDIF -->
					<!-- END news_row_tab1 -->
				</ul>
				</dd>
			</dl>
			<br style="clear:both" />		
		</div>

		<div style="display: none;" class="panel bg1" id="tab2-panel">
			<dl>
				<dd class="posts_portal"  style="border-left:0px">
				<ul class="news">
					<!-- BEGIN news_row_tab2 -->
					<!-- IF news_row_tab2.S_NO_TOPICS -->
					<li>
					<span class="gensmall" style="text-align: center; margin: 0 0 0 5px;"><strong>{L_NO_NEWS}</strong></span>
					</li>
					<!-- ELSE -->
					<li>
						<span style="float: left; margin: 0 0 0 5px;"><img src="{T_THEME_PATH}/images/arrow_right.gif" alt=""/> 
						<!-- IF news_row_tab2.S_UNREAD_INFO -->{NEWEST_POST_IMG}<!-- ELSE -->{READ_POST_IMG}<!-- ENDIF --> {news_row_tab2.ATTACH_ICON_IMG}  <!-- IF news_row_tab2.S_POLL --><strong>{L_POLL}: </strong><!-- ENDIF --><a href="{news_row_tab2.U_LAST_COMMENTS}" title="{L_JUMP_NEWEST}"><strong style="font-size:1.1em;">{news_row_tab2.TITLE}</strong></a></span>
						<span style="float: right; margin: 0 5px 0 0;">{L_LAST_POST} {L_POST_BY_AUTHOR}: <strong><a href="{news_row_tab2.U_USER_PROFILE}">{news_row_tab2.POSTER}</a></strong></span>
						<br style="clear:both" />
						<!-- IF news_row_tab2.FORUM_NAME -->
						<span style="float: left; font-size:1.0em; margin: 2px 0 0 28px;">{L_FORUM}: <strong><a href="{news_row_tab2.U_VIEWFORUM}">{news_row_tab2.FORUM_NAME}</a></strong></span>
						<!-- ENDIF -->
						<span style="float: right; margin: 0 5px 0 0;">{L_POSTED_ON_DATE} <strong>{news_row_tab2.TIME}</strong></span>
						<br style="clear:both" />
						<span style="float: left; margin: 0 0 0 28px;">
							<a href="{news_row_tab2.U_VIEW_COMMENTS}" title="{L_JUMP_FIRST}"><span style="font-size:0.9em;"><em>{L_COMMENTS}: {news_row_tab2.REPLIES}</em></span></a>
							<span style="font-size:0.9em;"><em>{L_TOPIC_VIEWS}: {news_row_tab2.TOPIC_VIEWS}</em></span>
						</span>
						<!-- IF news_row_tab2.S_NOT_LAST --><hr style="margin: 0px 0px 3px 0px;" /><!-- ENDIF -->						
					</li>
					<!-- ENDIF -->
					<!-- END news_row_tab2 -->
				</ul>
				</dd>
			</dl>
			<br style="clear:both" />		
		</div>
		
		<div style="display: none;" class="panel bg1" id="tab3-panel">
			<dl>
				<dd class="posts_portal"  style="border-left:0px">
				<ul class="news">
					<!-- BEGIN news_row_tab3 -->
					<!-- IF news_row_tab3.S_NO_TOPICS -->
					<li>
					<span class="gensmall" style="text-align: center; margin: 0 0 0 5px;"><strong>{L_NO_NEWS}</strong></span>
					</li>
					<!-- ELSE -->
					<li>
						<span style="float: left; margin: 0 0 0 5px;"><img src="{T_THEME_PATH}/images/arrow_right.gif" alt=""/> 
						<!-- IF news_row_tab3.S_UNREAD_INFO -->{NEWEST_POST_IMG}<!-- ELSE -->{READ_POST_IMG}<!-- ENDIF --> {news_row_tab3.ATTACH_ICON_IMG}  <!-- IF news_row_tab3.S_POLL --><strong>{L_POLL}: </strong><!-- ENDIF --><a href="{news_row_tab3.U_LAST_COMMENTS}" title="{L_JUMP_NEWEST}"><strong style="font-size:1.1em;">{news_row_tab3.TITLE}</strong></a></span>
						<span style="float: right; margin: 0 5px 0 0;">{L_LAST_POST} {L_POST_BY_AUTHOR}: <strong><a href="{news_row_tab3.U_USER_PROFILE}">{news_row_tab3.POSTER}</a></strong></span>
						<br style="clear:both" />
						<!-- IF news_row_tab3.FORUM_NAME -->
						<span style="float: left; font-size:1.0em; margin: 2px 0 0 28px;">{L_FORUM}: <strong><a href="{news_row_tab3.U_VIEWFORUM}">{news_row_tab3.FORUM_NAME}</a></strong></span>
						<!-- ENDIF -->
						<span style="float: right; margin: 0 5px 0 0;">{L_POSTED_ON_DATE} <strong>{news_row_tab3.TIME}</strong></span>
						<br style="clear:both" />
						<span style="float: left; margin: 0 0 0 28px;">
							<a href="{news_row_tab3.U_VIEW_COMMENTS}" title="{L_JUMP_FIRST}"><span style="font-size:0.9em;"><em>{L_COMMENTS}: {news_row_tab3.REPLIES}</em></span></a>
							<span style="font-size:0.9em;"><em>{L_TOPIC_VIEWS}: {news_row_tab3.TOPIC_VIEWS}</em></span>
						</span>
						<!-- IF news_row_tab3.S_NOT_LAST --><hr style="margin: 0px 0px 3px 0px;" /><!-- ENDIF -->						
					</li>
					<!-- ENDIF -->
					<!-- END news_row_tab3 -->
				</ul>
				</dd>
			</dl>
			<br style="clear:both" />		
		</div>
		
		<div style="display: none;" class="panel bg1" id="tab4-panel">
			<dl>
				<dd class="posts_portal"  style="border-left:0px">
				<ul class="news">
					<!-- BEGIN news_row_tab4 -->
					<!-- IF news_row_tab4.S_NO_TOPICS -->
					<li>
					<span class="gensmall" style="text-align: center; margin: 0 0 0 5px;"><strong>{L_NO_NEWS}</strong></span>
					</li>
					<!-- ELSE -->
					<li>
						<span style="float: left; margin: 0 0 0 5px;"><img src="{T_THEME_PATH}/images/arrow_right.gif" alt=""/> 
						<!-- IF news_row_tab4.S_UNREAD_INFO -->{NEWEST_POST_IMG}<!-- ELSE -->{READ_POST_IMG}<!-- ENDIF --> {news_row_tab4.ATTACH_ICON_IMG}  <!-- IF news_row_tab4.S_POLL --><strong>{L_POLL}: </strong><!-- ENDIF --><a href="{news_row_tab4.U_LAST_COMMENTS}" title="{L_JUMP_NEWEST}"><strong style="font-size:1.1em;">{news_row_tab4.TITLE}</strong></a></span>
						<span style="float: right; margin: 0 5px 0 0;">{L_LAST_POST} {L_POST_BY_AUTHOR}: <strong><a href="{news_row_tab4.U_USER_PROFILE}">{news_row_tab4.POSTER}</a></strong></span>
						<br style="clear:both" />
						<!-- IF news_row_tab4.FORUM_NAME -->
						<span style="float: left; font-size:1.0em; margin: 2px 0 0 28px;">{L_FORUM}: <strong><a href="{news_row_tab4.U_VIEWFORUM}">{news_row_tab4.FORUM_NAME}</a></strong></span>
						<!-- ENDIF -->
						<span style="float: right; margin: 0 5px 0 0;">{L_POSTED_ON_DATE} <strong>{news_row_tab4.TIME}</strong></span>
						<br style="clear:both" />
						<span style="float: left; margin: 0 0 0 28px;">
							<a href="{news_row_tab4.U_VIEW_COMMENTS}" title="{L_JUMP_FIRST}"><span style="font-size:0.9em;"><em>{L_COMMENTS}: {news_row_tab4.REPLIES}</em></span></a>
							<span style="font-size:0.9em;"><em>{L_TOPIC_VIEWS}: {news_row_tab4.TOPIC_VIEWS}</em></span>
						</span>
						<!-- IF news_row_tab4.S_NOT_LAST --><hr style="margin: 0px 0px 3px 0px;" /><!-- ENDIF -->						
					</li>
					<!-- ENDIF -->
					<!-- END news_row_tab4 -->
				</ul>
				</dd>
			</dl>
			<br style="clear:both" />		
		</div>
		
		<div style="display: none;" class="panel bg1" id="tab5-panel">
			<dl>
				<dd class="posts_portal"  style="border-left:0px">
				<ul class="news">
					<!-- BEGIN news_row_tab5 -->
					<!-- IF news_row_tab5.S_NO_TOPICS -->
					<li>
					<span class="gensmall" style="text-align: center; margin: 0 0 0 5px;"><strong>{L_NO_NEWS}</strong></span>
					</li>
					<!-- ELSE -->
					<li>
						<span style="float: left; margin: 0 0 0 5px;"><img src="{T_THEME_PATH}/images/arrow_right.gif" alt=""/> 
						<!-- IF news_row_tab5.S_UNREAD_INFO -->{NEWEST_POST_IMG}<!-- ELSE -->{READ_POST_IMG}<!-- ENDIF --> {news_row_tab5.ATTACH_ICON_IMG}  <!-- IF news_row_tab5.S_POLL --><strong>{L_POLL}: </strong><!-- ENDIF --><a href="{news_row_tab5.U_LAST_COMMENTS}" title="{L_JUMP_NEWEST}"><strong style="font-size:1.1em;">{news_row_tab5.TITLE}</strong></a></span>
						<span style="float: right; margin: 0 5px 0 0;">{L_LAST_POST} {L_POST_BY_AUTHOR}: <strong><a href="{news_row_tab5.U_USER_PROFILE}">{news_row_tab5.POSTER}</a></strong></span>
						<br style="clear:both" />
						<!-- IF news_row_tab5.FORUM_NAME -->
						<span style="float: left; font-size:1.0em; margin: 2px 0 0 28px;">{L_FORUM}: <strong><a href="{news_row_tab5.U_VIEWFORUM}">{news_row_tab5.FORUM_NAME}</a></strong></span>
						<!-- ENDIF -->
						<span style="float: right; margin: 0 5px 0 0;">{L_POSTED_ON_DATE} <strong>{news_row_tab5.TIME}</strong></span>
						<br style="clear:both" />
						<span style="float: left; margin: 0 0 0 28px;">
							<a href="{news_row_tab5.U_VIEW_COMMENTS}" title="{L_JUMP_FIRST}"><span style="font-size:0.9em;"><em>{L_COMMENTS}: {news_row_tab5.REPLIES}</em></span></a>
							<span style="font-size:0.9em;"><em>{L_TOPIC_VIEWS}: {news_row_tab5.TOPIC_VIEWS}</em></span>
						</span>
						<!-- IF news_row_tab5.S_NOT_LAST --><hr style="margin: 0px 0px 3px 0px;" /><!-- ENDIF -->						
					</li>
					<!-- ENDIF -->
					<!-- END news_row_tab5 -->
				</ul>
				</dd>
			</dl>
			<br style="clear:both" />				
		</div>		
		
		<div style="display: none;" class="panel bg1" id="tab6-panel">
			<dl>
				<dd class="posts_portal"  style="border-left:0px">
				<ul class="news">
					<!-- BEGIN news_row_tab6 -->
					<!-- IF news_row_tab6.S_NO_TOPICS -->
					<li>
					<span class="gensmall" style="text-align: center; margin: 0 0 0 5px;"><strong>{L_NO_NEWS}</strong></span>
					</li>
					<!-- ELSE -->
					<li>
						<span style="float: left; margin: 0 0 0 5px;"><img src="{T_THEME_PATH}/images/arrow_right.gif" alt=""/> 
						<!-- IF news_row_tab6.S_UNREAD_INFO -->{NEWEST_POST_IMG}<!-- ELSE -->{READ_POST_IMG}<!-- ENDIF --> {news_row_tab6.ATTACH_ICON_IMG}  <!-- IF news_row_tab6.S_POLL --><strong>{L_POLL}: </strong><!-- ENDIF --><a href="{news_row_tab6.U_LAST_COMMENTS}" title="{L_JUMP_NEWEST}"><strong style="font-size:1.1em;">{news_row_tab6.TITLE}</strong></a></span>
						<span style="float: right; margin: 0 5px 0 0;">{L_LAST_POST} {L_POST_BY_AUTHOR}: <strong><a href="{news_row_tab6.U_USER_PROFILE}">{news_row_tab6.POSTER}</a></strong></span>
						<br style="clear:both" />
						<!-- IF news_row_tab6.FORUM_NAME -->
						<span style="float: left; font-size:1.0em; margin: 2px 0 0 28px;">{L_FORUM}: <strong><a href="{news_row_tab6.U_VIEWFORUM}">{news_row_tab6.FORUM_NAME}</a></strong></span>
						<!-- ENDIF -->
						<span style="float: right; margin: 0 5px 0 0;">{L_POSTED_ON_DATE} <strong>{news_row_tab6.TIME}</strong></span>
						<br style="clear:both" />
						<span style="float: left; margin: 0 0 0 28px;">
							<a href="{news_row_tab6.U_VIEW_COMMENTS}" title="{L_JUMP_FIRST}"><span style="font-size:0.9em;"><em>{L_COMMENTS}: {news_row_tab6.REPLIES}</em></span></a>
							<span style="font-size:0.9em;"><em>{L_TOPIC_VIEWS}: {news_row_tab6.TOPIC_VIEWS}</em></span>
						</span>
						<!-- IF news_row_tab6.S_NOT_LAST --><hr style="margin: 0px 0px 3px 0px;" /><!-- ENDIF -->						
					</li>
					<!-- ENDIF -->
					<!-- END news_row_tab6 -->
				</ul>
				</dd>
			</dl>
			<br style="clear:both" />		
		</div>
		
		<div style="display: none;" class="panel bg1" id="tab7-panel">
			<dl>
				<dd class="posts_portal"  style="border-left:0px">
				<ul class="news">
					<!-- BEGIN news_row_tab7 -->
					<!-- IF news_row_tab7.S_NO_TOPICS -->
					<li>
					<span class="gensmall" style="text-align: center; margin: 0 0 0 5px;"><strong>{L_NO_NEWS}</strong></span>
					</li>
					<!-- ELSE -->
					<li>
						<span style="float: left; margin: 0 0 0 5px;"><img src="{T_THEME_PATH}/images/arrow_right.gif" alt=""/> 
						<!-- IF news_row_tab7.S_UNREAD_INFO -->{NEWEST_POST_IMG}<!-- ELSE -->{READ_POST_IMG}<!-- ENDIF --> {news_row_tab7.ATTACH_ICON_IMG}  <!-- IF news_row_tab7.S_POLL --><strong>{L_POLL}: </strong><!-- ENDIF --><a href="{news_row_tab7.U_LAST_COMMENTS}" title="{L_JUMP_NEWEST}"><strong style="font-size:1.1em;">{news_row_tab7.TITLE}</strong></a></span>
						<span style="float: right; margin: 0 5px 0 0;">{L_LAST_POST} {L_POST_BY_AUTHOR}: <strong><a href="{news_row_tab7.U_USER_PROFILE}">{news_row_tab7.POSTER}</a></strong></span>
						<br style="clear:both" />
						<!-- IF news_row_tab7.FORUM_NAME -->
						<span style="float: left; font-size:1.0em; margin: 2px 0 0 28px;">{L_FORUM}: <strong><a href="{news_row_tab7.U_VIEWFORUM}">{news_row_tab7.FORUM_NAME}</a></strong></span>
						<!-- ENDIF -->
						<span style="float: right; margin: 0 5px 0 0;">{L_POSTED_ON_DATE} <strong>{news_row_tab7.TIME}</strong></span>
						<br style="clear:both" />
						<span style="float: left; margin: 0 0 0 28px;">
							<a href="{news_row_tab7.U_VIEW_COMMENTS}" title="{L_JUMP_FIRST}"><span style="font-size:0.9em;"><em>{L_COMMENTS}: {news_row_tab7.REPLIES}</em></span></a>
							<span style="font-size:0.9em;"><em>{L_TOPIC_VIEWS}: {news_row_tab7.TOPIC_VIEWS}</em></span>
						</span>
						<!-- IF news_row_tab7.S_NOT_LAST --><hr style="margin: 0px 0px 3px 0px;" /><!-- ENDIF -->						
					</li>
					<!-- ENDIF -->
					<!-- END news_row_tab7 -->
				</ul>
				</dd>
			</dl>
			<br style="clear:both" />		
		</div>
		
		</div>
		<span class="corners-bottom"><span></span></span>
	</div>
</div>
<br style="clear:both" />
EXPLAINING THE CODE ABOVE CAUSE YOU NEED TO EDIT IT TO FIT YOUR NEEDS

Code: Select all

	var panels = new Array('tab1-panel', 'tab2-panel', 'tab3-panel', 'tab4-panel', 'tab5-panel', 'tab6-panel', 'tab7-panel');
Here you have the tabs names used for the javascript. You dont need to edit it - but you might need to delete some of them or add a new panel if you need more tabs.

Code: Select all

	var show_panel = 'tab1-panel';
Here you type in the panel name that have to be pre-selected

Code: Select all

		<li class="activetab" id="tab1-panel-tab"><a href="#tabs" onclick="subPanels('tab1-panel'); return false;"><span>All</span></a></li>
		<li class="" id="tab2-panel-tab"><a href="#tabs" onclick="subPanels('tab2-panel'); return false;"><span>Tab 2</span></a></li>
		<li class="" id="tab3-panel-tab"><a href="#tabs" onclick="subPanels('tab3-panel'); return false;"><span>Tab 3</span></a></li>
		<li class="" id="tab4-panel-tab"><a href="#tabs" onclick="subPanels('tab4-panel'); return false;"><span>Tab 4</span></a></li>
		<li class="" id="tab5-panel-tab"><a href="#tabs" onclick="subPanels('tab5-panel'); return false;"><span>Tab 5</span></a></li>
		<li class="" id="tab6-panel-tab"><a href="#tabs" onclick="subPanels('tab6-panel'); return false;"><span>Tab 6</span></a></li>	
		<li class="" id="tab7-panel-tab"><a href="#tabs" onclick="subPanels('tab7-panel'); return false;"><span>Tab 7</span></a></li>
This is the code that create the tabs. You may want to delete the panels you dont need.
You may want to change the tab names. You need to edit:

Code: Select all

<span>Tab 2</span>
to eg

Code: Select all

<span>This is my tab</span>

Code: Select all

		<div style="display: block;" class="panel bg1" id="tab1-panel">
			<dl>
				<dd class="posts_portal"  style="border-left:0px">
				<ul class="news">
					<!-- BEGIN news_row_tab1 -->
					<!-- IF news_row_tab1.S_NO_TOPICS -->
					<li>
					<span class="gensmall" style="text-align: center; margin: 0 0 0 5px;"><strong>{L_NO_NEWS}</strong></span>
					</li>
					<!-- ELSE -->
					<li>
						<span style="float: left; margin: 0 0 0 5px;"><img src="{T_THEME_PATH}/images/arrow_right.gif" alt=""/> 
						<!-- IF news_row_tab1.S_UNREAD_INFO -->{NEWEST_POST_IMG}<!-- ELSE -->{READ_POST_IMG}<!-- ENDIF --> {news_row_tab1.ATTACH_ICON_IMG}  <!-- IF news_row_tab1.S_POLL --><strong>{L_POLL}: </strong><!-- ENDIF --><a href="{news_row_tab1.U_LAST_COMMENTS}" title="{L_JUMP_NEWEST}"><strong style="font-size:1.1em;">{news_row_tab1.TITLE}</strong></a></span>
						<span style="float: right; margin: 0 5px 0 0;">{L_LAST_POST} {L_POST_BY_AUTHOR}: <strong><a href="{news_row_tab1.U_USER_PROFILE}">{news_row_tab1.POSTER}</a></strong></span>
						<br style="clear:both" />
						<!-- IF news_row_tab1.FORUM_NAME -->
						<span style="float: left; font-size:1.0em; margin: 2px 0 0 28px;">{L_FORUM}: <strong><a href="{news_row_tab1.U_VIEWFORUM}">{news_row_tab1.FORUM_NAME}</a></strong></span>
						<!-- ENDIF -->
						<span style="float: right; margin: 0 5px 0 0;">{L_POSTED_ON_DATE} <strong>{news_row_tab1.TIME}</strong></span>
						<br style="clear:both" />
						<span style="float: left; margin: 0 0 0 28px;">
							<a href="{news_row_tab1.U_VIEW_COMMENTS}" title="{L_JUMP_FIRST}"><span style="font-size:0.9em;"><em>{L_COMMENTS}: {news_row_tab1.REPLIES}</em></span></a>
							<span style="font-size:0.9em;"><em>{L_TOPIC_VIEWS}: {news_row_tab1.TOPIC_VIEWS}</em></span>
						</span>
						<!-- IF news_row_tab1.S_NOT_LAST --><hr style="margin: 0px 0px 3px 0px;" /><!-- ENDIF -->						
					</li>
					<!-- ENDIF -->
					<!-- END news_row_tab1 -->
				</ul>
				</dd>
			</dl>
			<br style="clear:both" />		
		</div>
This is code that give you the content you see when you press on tab1. You have 7 of these blocks. The only different in all the blocks is like

Code: Select all

news_row_tab1
in the code used for tab2 its

Code: Select all

news_row_tab2
- see the system ;-)

OPEN
portal.php

Code: Select all

    if ($portal_config['portal_change_style'])
    {
       include($phpbb_root_path . 'portal/block/change_style.'.$phpEx);
    }
AFTER ADD

Code: Select all

include($phpbb_root_path . 'portal/block/tabnews.'.$phpEx);
OPEN
styles/prosilver/template/portal/portal_body.html

FIND

Code: Select all

		<!-- IF S_DISPLAY_NEWS -->
		<!-- IF S_NEWS_COMPACT -->
			<!-- INCLUDE portal/block/news_compact.html -->
		<!-- ELSE -->
			<!-- INCLUDE portal/block/news.html -->
		<!-- ENDIF -->
		<!-- ENDIF -->
REPLACE WITH

Code: Select all

		<!-- INCLUDE portal/block/tabnews.html -->

CREATE
portal/block/tabnews.php

REPLACE ALL WITH

Code: Select all

<?php

/**
*
* @package - Board3portal
* @version $Id: news.php 96 2008-02-05 16:52:11Z IcedCold $
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) Ice, (c) nickvergessen ( http://www.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.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'))
{
   exit;
}

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

//
// Fetch Posts for news from portal/includes/functions.php
//
$template->assign_vars(array(
	'NEWEST_POST_IMG'			=> $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
	'READ_POST_IMG'				=> $user->img('icon_topic_latest', 'VIEW_NEWEST_POST'),
	'S_DISPLAY_NEWS'			=> true,
));
// T A B 1  L A T E S T  P O S T  F R O M  A L L  F O R U M S
#if (!isset($HTTP_GET_VARS['article']))
$news = request_var('news', -1);
if($news < 0)
{
	$fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_config['portal_number_of_news'], $portal_config['portal_news_length'], 0, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news');

	if (count($fetch_news) == 0)
	{
		$template->assign_block_vars('news_row_tab1', array(
			'S_NO_TOPICS'	=> true,
			'S_NOT_LAST'	=> false
		));
	}
	else
	{
		for ($i = 0; $i < count($fetch_news); $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;

			$template->assign_block_vars('news_row_tab1', array(
				'ATTACH_ICON_IMG'	=> ($fetch_news[$i]['attachment']) ? $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'],
				'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'],
				'TEXT'					=> $fetch_news[$i]['post_text'],
				'REPLIES'				=> $fetch_news[$i]['topic_replies'],
				'TOPIC_VIEWS'		=> $fetch_news[$i]['topic_views'],
				'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'] . '&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']),
				'U_READ_FULL'		=> append_sid("{$phpbb_root_path}portal.$phpEx", 'news=' . $i),
				'L_READ_FULL'			=> $read_full,
				'OPEN'					=> $open_bracket,
				'CLOSE'				=> $close_bracket,
				'S_NOT_LAST'			=> ($i < count($fetch_news) - 1) ? true : false,
				'S_POLL'				=> $fetch_news[$i]['poll'],
				'S_UNREAD_INFO'		=> $unread_topic,
			));
		}
	}
}
//T A B 2
$portal_config['portal_news_forum_tab2'] = '1, 2 ,3'; //Here you type in the forum_id af the forum you want to get the latest news from when pressing the tab. If you type in more forum they have to be comma separated
$fetch_news_tab2 = phpbb_fetch_posts($portal_config['portal_news_forum_tab2'], $portal_config['portal_number_of_news'], $portal_config['portal_news_length'], 0, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news');

	if (count($fetch_news_tab2) == 0)
	{
		$template->assign_block_vars('news_row_tab2', array(
			'S_NO_TOPICS'	=> true,
			'S_NOT_LAST'	=> false
		));
	}
	else
	{
		for ($i = 0; $i < count($fetch_news_tab2); $i++)
		{
			if( isset($fetch_news_tab2[$i]['striped']) && $fetch_news_tab2[$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_tab2[$i]['forum_id'];
			$topic_id = $fetch_news_tab2[$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_tab2[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;

			$template->assign_block_vars('news_row_tab2', array(
				'ATTACH_ICON_IMG'	=> ($fetch_news_tab2[$i]['attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
				'FORUM_NAME'		=> ( $forum_id ) ? $fetch_news_tab2[$i]['forum_name'] : '',
				'TITLE'					=> $fetch_news_tab2[$i]['topic_title'],
				'POSTER'				=> $fetch_news_tab2[$i]['username'],
				'U_USER_PROFILE'		=> (($fetch_news_tab2[$i]['user_type'] == USER_NORMAL || $fetch_news_tab2[$i]['user_type'] == USER_FOUNDER) && $fetch_news_tab2[$i]['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $fetch_news_tab2[$i]['user_id']) : '',
				'TIME'					=> $fetch_news_tab2[$i]['topic_time'],
				'TEXT'					=> $fetch_news_tab2[$i]['post_text'],
				'REPLIES'				=> $fetch_news_tab2[$i]['topic_replies'],
				'TOPIC_VIEWS'		=> $fetch_news_tab2[$i]['topic_views'],
				'U_VIEWFORUM'		=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $fetch_news_tab2[$i]['forum_id']),
				'U_LAST_COMMENTS'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news_tab2[$i]['forum_id'] . '&p=' . $fetch_news_tab2[$i]['topic_last_post_id'] . '#p' . $fetch_news_tab2[$i]['topic_last_post_id']),
				'U_VIEW_COMMENTS'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news_tab2[$i]['forum_id'] . '&t=' . $fetch_news_tab2[$i]['topic_id']),
				'U_POST_COMMENT'	=> append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=reply&f=' . $fetch_news_tab2[$i]['forum_id'] . '&t=' . $fetch_news_tab2[$i]['topic_id']),
				'U_READ_FULL'		=> append_sid("{$phpbb_root_path}portal.$phpEx", 'news=' . $i),
				'L_READ_FULL'			=> $read_full,
				'OPEN'					=> $open_bracket,
				'CLOSE'				=> $close_bracket,
				'S_NOT_LAST'			=> ($i < count($fetch_news_tab2) - 1) ? true : false,
				'S_POLL'				=> $fetch_news_tab2[$i]['poll'],
				'S_UNREAD_INFO'		=> $unread_topic,
			));
		}
	}
//T A B 3
$portal_config['portal_news_forum_tab3'] = '4'; //Here you type in the forum_id af the forum you want to get the latest news from when pressing the tab. If you type in more forum they have to be comma separated
$fetch_news_tab3 = phpbb_fetch_posts($portal_config['portal_news_forum_tab3'], $portal_config['portal_number_of_news'], $portal_config['portal_news_length'], 0, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news');

	if (count($fetch_news_tab3) == 0)
	{
		$template->assign_block_vars('news_row_tab3', array(
			'S_NO_TOPICS'	=> true,
			'S_NOT_LAST'	=> false
		));
	}
	else
	{
		for ($i = 0; $i < count($fetch_news_tab3); $i++)
		{
			if( isset($fetch_news_tab3[$i]['striped']) && $fetch_news_tab3[$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_tab3[$i]['forum_id'];
			$topic_id = $fetch_news_tab3[$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_tab3[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;

			$template->assign_block_vars('news_row_tab3', array(
				'ATTACH_ICON_IMG'	=> ($fetch_news_tab3[$i]['attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
				'FORUM_NAME'		=> ( $forum_id ) ? $fetch_news_tab3[$i]['forum_name'] : '',
				'TITLE'					=> $fetch_news_tab3[$i]['topic_title'],
				'POSTER'				=> $fetch_news_tab3[$i]['username'],
				'U_USER_PROFILE'		=> (($fetch_news_tab3[$i]['user_type'] == USER_NORMAL || $fetch_news_tab3[$i]['user_type'] == USER_FOUNDER) && $fetch_news_tab3[$i]['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $fetch_news_tab3[$i]['user_id']) : '',
				'TIME'					=> $fetch_news_tab3[$i]['topic_time'],
				'TEXT'					=> $fetch_news_tab3[$i]['post_text'],
				'REPLIES'				=> $fetch_news_tab3[$i]['topic_replies'],
				'TOPIC_VIEWS'		=> $fetch_news_tab3[$i]['topic_views'],
				'U_VIEWFORUM'		=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $fetch_news_tab3[$i]['forum_id']),
				'U_LAST_COMMENTS'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news_tab3[$i]['forum_id'] . '&p=' . $fetch_news_tab3[$i]['topic_last_post_id'] . '#p' . $fetch_news_tab3[$i]['topic_last_post_id']),
				'U_VIEW_COMMENTS'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news_tab3[$i]['forum_id'] . '&t=' . $fetch_news_tab3[$i]['topic_id']),
				'U_POST_COMMENT'	=> append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=reply&f=' . $fetch_news_tab3[$i]['forum_id'] . '&t=' . $fetch_news_tab3[$i]['topic_id']),
				'U_READ_FULL'		=> append_sid("{$phpbb_root_path}portal.$phpEx", 'news=' . $i),
				'L_READ_FULL'			=> $read_full,
				'OPEN'					=> $open_bracket,
				'CLOSE'				=> $close_bracket,
				'S_NOT_LAST'			=> ($i < count($fetch_news_tab3) - 1) ? true : false,
				'S_POLL'				=> $fetch_news_tab3[$i]['poll'],
				'S_UNREAD_INFO'		=> $unread_topic,
			));
		}
	}

//T A B 4
$portal_config['portal_news_forum_tab4'] = '5, 6, 7'; //Here you type in the forum_id af the forum you want to get the latest news from when pressing the tab. If you type in more forum they have to be comma separated
$fetch_news_tab4 = phpbb_fetch_posts($portal_config['portal_news_forum_tab4'], $portal_config['portal_number_of_news'], $portal_config['portal_news_length'], 0, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news');

	if (count($fetch_news_tab4) == 0)
	{
		$template->assign_block_vars('news_row_tab4', array(
			'S_NO_TOPICS'	=> true,
			'S_NOT_LAST'	=> false
		));
	}
	else
	{
		for ($i = 0; $i < count($fetch_news_tab4); $i++)
		{
			if( isset($fetch_news_tab4[$i]['striped']) && $fetch_news_tab4[$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_tab4[$i]['forum_id'];
			$topic_id = $fetch_news_tab4[$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_tab4[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;

			$template->assign_block_vars('news_row_tab4', array(
				'ATTACH_ICON_IMG'	=> ($fetch_news_tab4[$i]['attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
				'FORUM_NAME'		=> ( $forum_id ) ? $fetch_news_tab4[$i]['forum_name'] : '',
				'TITLE'					=> $fetch_news_tab4[$i]['topic_title'],
				'POSTER'				=> $fetch_news_tab4[$i]['username'],
				'U_USER_PROFILE'		=> (($fetch_news_tab4[$i]['user_type'] == USER_NORMAL || $fetch_news_tab4[$i]['user_type'] == USER_FOUNDER) && $fetch_news_tab4[$i]['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $fetch_news_tab4[$i]['user_id']) : '',
				'TIME'					=> $fetch_news_tab4[$i]['topic_time'],
				'TEXT'					=> $fetch_news_tab4[$i]['post_text'],
				'REPLIES'				=> $fetch_news_tab4[$i]['topic_replies'],
				'TOPIC_VIEWS'		=> $fetch_news_tab4[$i]['topic_views'],
				'U_VIEWFORUM'		=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $fetch_news_tab4[$i]['forum_id']),
				'U_LAST_COMMENTS'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news_tab4[$i]['forum_id'] . '&p=' . $fetch_news_tab4[$i]['topic_last_post_id'] . '#p' . $fetch_news_tab4[$i]['topic_last_post_id']),
				'U_VIEW_COMMENTS'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news_tab4[$i]['forum_id'] . '&t=' . $fetch_news_tab4[$i]['topic_id']),
				'U_POST_COMMENT'	=> append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=reply&f=' . $fetch_news_tab4[$i]['forum_id'] . '&t=' . $fetch_news_tab4[$i]['topic_id']),
				'U_READ_FULL'		=> append_sid("{$phpbb_root_path}portal.$phpEx", 'news=' . $i),
				'L_READ_FULL'			=> $read_full,
				'OPEN'					=> $open_bracket,
				'CLOSE'				=> $close_bracket,
				'S_NOT_LAST'			=> ($i < count($fetch_news_tab4) - 1) ? true : false,
				'S_POLL'				=> $fetch_news_tab4[$i]['poll'],
				'S_UNREAD_INFO'		=> $unread_topic,
			));
		}
	}

//T A B 5
$portal_config['portal_news_forum_tab5'] = '9, 10'; //Here you type in the forum_id af the forum you want to get the latest news from when pressing the tab. If you type in more forum they have to be comma separated
$fetch_news_tab5 = phpbb_fetch_posts($portal_config['portal_news_forum_tab5'], $portal_config['portal_number_of_news'], $portal_config['portal_news_length'], 0, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news');

	if (count($fetch_news_tab5) == 0)
	{
		$template->assign_block_vars('news_row_tab5', array(
			'S_NO_TOPICS'	=> true,
			'S_NOT_LAST'	=> false
		));
	}
	else
	{
		for ($i = 0; $i < count($fetch_news_tab5); $i++)
		{
			if( isset($fetch_news_tab5[$i]['striped']) && $fetch_news_tab5[$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_tab5[$i]['forum_id'];
			$topic_id = $fetch_news_tab5[$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_tab5[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;

			$template->assign_block_vars('news_row_tab5', array(
				'ATTACH_ICON_IMG'	=> ($fetch_news_tab5[$i]['attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
				'FORUM_NAME'		=> ( $forum_id ) ? $fetch_news_tab5[$i]['forum_name'] : '',
				'TITLE'					=> $fetch_news_tab5[$i]['topic_title'],
				'POSTER'				=> $fetch_news_tab5[$i]['username'],
				'U_USER_PROFILE'		=> (($fetch_news_tab5[$i]['user_type'] == USER_NORMAL || $fetch_news_tab5[$i]['user_type'] == USER_FOUNDER) && $fetch_news_tab5[$i]['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $fetch_news_tab5[$i]['user_id']) : '',
				'TIME'					=> $fetch_news_tab5[$i]['topic_time'],
				'TEXT'					=> $fetch_news_tab5[$i]['post_text'],
				'REPLIES'				=> $fetch_news_tab5[$i]['topic_replies'],
				'TOPIC_VIEWS'		=> $fetch_news_tab5[$i]['topic_views'],
				'U_VIEWFORUM'		=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $fetch_news_tab5[$i]['forum_id']),
				'U_LAST_COMMENTS'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news_tab5[$i]['forum_id'] . '&p=' . $fetch_news_tab5[$i]['topic_last_post_id'] . '#p' . $fetch_news_tab5[$i]['topic_last_post_id']),
				'U_VIEW_COMMENTS'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news_tab5[$i]['forum_id'] . '&t=' . $fetch_news_tab5[$i]['topic_id']),
				'U_POST_COMMENT'	=> append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=reply&f=' . $fetch_news_tab5[$i]['forum_id'] . '&t=' . $fetch_news_tab5[$i]['topic_id']),
				'U_READ_FULL'		=> append_sid("{$phpbb_root_path}portal.$phpEx", 'news=' . $i),
				'L_READ_FULL'			=> $read_full,
				'OPEN'					=> $open_bracket,
				'CLOSE'				=> $close_bracket,
				'S_NOT_LAST'			=> ($i < count($fetch_news_tab5) - 1) ? true : false,
				'S_POLL'				=> $fetch_news_tab5[$i]['poll'],
				'S_UNREAD_INFO'		=> $unread_topic,
			));
		}
	}
//T A B 6
$portal_config['portal_news_forum_tab6'] = '11'; //Here you type in the forum_id af the forum you want to get the latest news from when pressing the tab. If you type in more forum they have to be comma separated
$fetch_news_tab6 = phpbb_fetch_posts($portal_config['portal_news_forum_tab6'], $portal_config['portal_number_of_news'], $portal_config['portal_news_length'], 0, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news');

	if (count($fetch_news_tab6) == 0)
	{
		$template->assign_block_vars('news_row_tab6', array(
			'S_NO_TOPICS'	=> true,
			'S_NOT_LAST'	=> false
		));
	}
	else
	{
		for ($i = 0; $i < count($fetch_news_tab6); $i++)
		{
			if( isset($fetch_news_tab6[$i]['striped']) && $fetch_news_tab6[$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_tab6[$i]['forum_id'];
			$topic_id = $fetch_news_tab6[$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_tab6[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;

			$template->assign_block_vars('news_row_tab6', array(
				'ATTACH_ICON_IMG'	=> ($fetch_news_tab6[$i]['attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
				'FORUM_NAME'		=> ( $forum_id ) ? $fetch_news_tab6[$i]['forum_name'] : '',
				'TITLE'					=> $fetch_news_tab6[$i]['topic_title'],
				'POSTER'				=> $fetch_news_tab6[$i]['username'],
				'U_USER_PROFILE'		=> (($fetch_news_tab6[$i]['user_type'] == USER_NORMAL || $fetch_news_tab6[$i]['user_type'] == USER_FOUNDER) && $fetch_news_tab6[$i]['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $fetch_news_tab6[$i]['user_id']) : '',
				'TIME'					=> $fetch_news_tab6[$i]['topic_time'],
				'TEXT'					=> $fetch_news_tab6[$i]['post_text'],
				'REPLIES'				=> $fetch_news_tab6[$i]['topic_replies'],
				'TOPIC_VIEWS'		=> $fetch_news_tab6[$i]['topic_views'],
				'U_VIEWFORUM'		=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $fetch_news_tab6[$i]['forum_id']),
				'U_LAST_COMMENTS'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news_tab6[$i]['forum_id'] . '&p=' . $fetch_news_tab6[$i]['topic_last_post_id'] . '#p' . $fetch_news_tab6[$i]['topic_last_post_id']),
				'U_VIEW_COMMENTS'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news_tab6[$i]['forum_id'] . '&t=' . $fetch_news_tab6[$i]['topic_id']),
				'U_POST_COMMENT'	=> append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=reply&f=' . $fetch_news_tab6[$i]['forum_id'] . '&t=' . $fetch_news_tab6[$i]['topic_id']),
				'U_READ_FULL'		=> append_sid("{$phpbb_root_path}portal.$phpEx", 'news=' . $i),
				'L_READ_FULL'			=> $read_full,
				'OPEN'					=> $open_bracket,
				'CLOSE'				=> $close_bracket,
				'S_NOT_LAST'			=> ($i < count($fetch_news_tab6) - 1) ? true : false,
				'S_POLL'				=> $fetch_news_tab6[$i]['poll'],
				'S_UNREAD_INFO'		=> $unread_topic,
			));
		}
	}
//T A B 7
$portal_config['portal_news_forum_tab7'] = '12'; //Here you type in the forum_id af the forum you want to get the latest news from when pressing the tab. If you type in more forum they have to be comma separated
$fetch_news_tab7 = phpbb_fetch_posts($portal_config['portal_news_forum_tab7'], $portal_config['portal_number_of_news'], $portal_config['portal_news_length'], 0, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news');

	if (count($fetch_news_tab7) == 0)
	{
		$template->assign_block_vars('news_row_tab7', array(
			'S_NO_TOPICS'	=> true,
			'S_NOT_LAST'	=> false
		));
	}
	else
	{
		for ($i = 0; $i < count($fetch_news_tab7); $i++)
		{
			if( isset($fetch_news_tab7[$i]['striped']) && $fetch_news_tab7[$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_tab7[$i]['forum_id'];
			$topic_id = $fetch_news_tab7[$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_tab7[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;

			$template->assign_block_vars('news_row_tab7', array(
				'ATTACH_ICON_IMG'	=> ($fetch_news_tab7[$i]['attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
				'FORUM_NAME'		=> ( $forum_id ) ? $fetch_news_tab7[$i]['forum_name'] : '',
				'TITLE'					=> $fetch_news_tab7[$i]['topic_title'],
				'POSTER'				=> $fetch_news_tab7[$i]['username'],
				'U_USER_PROFILE'		=> (($fetch_news_tab7[$i]['user_type'] == USER_NORMAL || $fetch_news_tab7[$i]['user_type'] == USER_FOUNDER) && $fetch_news_tab7[$i]['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $fetch_news_tab7[$i]['user_id']) : '',
				'TIME'					=> $fetch_news_tab7[$i]['topic_time'],
				'TEXT'					=> $fetch_news_tab7[$i]['post_text'],
				'REPLIES'				=> $fetch_news_tab7[$i]['topic_replies'],
				'TOPIC_VIEWS'		=> $fetch_news_tab7[$i]['topic_views'],
				'U_VIEWFORUM'		=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $fetch_news_tab7[$i]['forum_id']),
				'U_LAST_COMMENTS'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news_tab7[$i]['forum_id'] . '&p=' . $fetch_news_tab7[$i]['topic_last_post_id'] . '#p' . $fetch_news_tab7[$i]['topic_last_post_id']),
				'U_VIEW_COMMENTS'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news_tab7[$i]['forum_id'] . '&t=' . $fetch_news_tab7[$i]['topic_id']),
				'U_POST_COMMENT'	=> append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=reply&f=' . $fetch_news_tab7[$i]['forum_id'] . '&t=' . $fetch_news_tab7[$i]['topic_id']),
				'U_READ_FULL'		=> append_sid("{$phpbb_root_path}portal.$phpEx", 'news=' . $i),
				'L_READ_FULL'			=> $read_full,
				'OPEN'					=> $open_bracket,
				'CLOSE'				=> $close_bracket,
				'S_NOT_LAST'			=> ($i < count($fetch_news_tab7) - 1) ? true : false,
				'S_POLL'				=> $fetch_news_tab7[$i]['poll'],
				'S_UNREAD_INFO'		=> $unread_topic,
			));
		}
	}
?>
EXPLAINING THE CODE ABOVE CAUSE YOU NEED TO EDIT IT TO FIT YOUR NEEDS

The above php code include 7 code boxes like this below. The first block differs and get news from all forums, but the 6 other block you might need to fit your needs.

Code: Select all

//T A B 2
$portal_config['portal_news_forum_tab2'] = '1, 2 ,3'; //Here you type in the forum_id af the forum you want to get the latest news from when pressing the tab. If you type in more forum they have to be comma separated
$fetch_news_tab2 = phpbb_fetch_posts($portal_config['portal_news_forum_tab2'], $portal_config['portal_number_of_news'], $portal_config['portal_news_length'], 0, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news');

	if (count($fetch_news_tab2) == 0)
	{
		$template->assign_block_vars('news_row_tab2', array(
			'S_NO_TOPICS'	=> true,
			'S_NOT_LAST'	=> false
		));
	}
	else
	{
		for ($i = 0; $i < count($fetch_news_tab2); $i++)
		{
			if( isset($fetch_news_tab2[$i]['striped']) && $fetch_news_tab2[$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_tab2[$i]['forum_id'];
			$topic_id = $fetch_news_tab2[$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_tab2[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;

			$template->assign_block_vars('news_row_tab2', array(
				'ATTACH_ICON_IMG'	=> ($fetch_news_tab2[$i]['attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
				'FORUM_NAME'		=> ( $forum_id ) ? $fetch_news_tab2[$i]['forum_name'] : '',
				'TITLE'					=> $fetch_news_tab2[$i]['topic_title'],
				'POSTER'				=> $fetch_news_tab2[$i]['username'],
				'U_USER_PROFILE'		=> (($fetch_news_tab2[$i]['user_type'] == USER_NORMAL || $fetch_news_tab2[$i]['user_type'] == USER_FOUNDER) && $fetch_news_tab2[$i]['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $fetch_news_tab2[$i]['user_id']) : '',
				'TIME'					=> $fetch_news_tab2[$i]['topic_time'],
				'TEXT'					=> $fetch_news_tab2[$i]['post_text'],
				'REPLIES'				=> $fetch_news_tab2[$i]['topic_replies'],
				'TOPIC_VIEWS'		=> $fetch_news_tab2[$i]['topic_views'],
				'U_VIEWFORUM'		=> append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $fetch_news_tab2[$i]['forum_id']),
				'U_LAST_COMMENTS'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news_tab2[$i]['forum_id'] . '&p=' . $fetch_news_tab2[$i]['topic_last_post_id'] . '#p' . $fetch_news_tab2[$i]['topic_last_post_id']),
				'U_VIEW_COMMENTS'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news_tab2[$i]['forum_id'] . '&t=' . $fetch_news_tab2[$i]['topic_id']),
				'U_POST_COMMENT'	=> append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=reply&f=' . $fetch_news_tab2[$i]['forum_id'] . '&t=' . $fetch_news_tab2[$i]['topic_id']),
				'U_READ_FULL'		=> append_sid("{$phpbb_root_path}portal.$phpEx", 'news=' . $i),
				'L_READ_FULL'			=> $read_full,
				'OPEN'					=> $open_bracket,
				'CLOSE'				=> $close_bracket,
				'S_NOT_LAST'			=> ($i < count($fetch_news_tab2) - 1) ? true : false,
				'S_POLL'				=> $fetch_news_tab2[$i]['poll'],
				'S_UNREAD_INFO'		=> $unread_topic,
			));
		}
	}
The blocks are differents like:

Code: Select all

$fetch_news_tab2
for tab2 where it would be

Code: Select all

$fetch_news_tab3
in the phpcode for tab3 etc.

You have to change:

Code: Select all

$portal_config['portal_news_forum_tab2'] = '1, 2 ,3'; //Here you type in the forum_id af the forum you want to get the latest news from when pressing the tab. If you type in more forum they have to be comma separated
Where

Code: Select all

'1, 2 ,3'
need to be replaced with the forum_id for the forums you need to have the latest posts from when pressing tab2. You need to do this for tab2-tab7. Not for tab1 as it give you the latest post from all forums!

Congrates you now have a tab-based menu!
Last edited by frold on 25. May 2008 20:54, edited 2 times in total.
http://www.studmed.dk - Portal for doctors and medical students in Denmark

User avatar

thomas.d
Former Team Member
Former Team Member
Posts: 625
Joined: 20. January 2008 00:56
phpBB.de User: thomas.d
phpBB.com User: thomas.d

Re: Tab based Latest News Block - advance skills needed!

Post by thomas.d » 25. May 2008 20:41

Wow, that's cool frold!
Viele Grüße

Thomas

Deutsche Sprachdateien für
[Alpha] phpBB Calendar 0.0.8 (alightner) | [RC] phpBB Arcade 1.0.RC8 |
ACP Add User MOD 1.0.0 |


Topic author
frold
Portal Enthusiast
Portal Enthusiast
Posts: 108
Joined: 24. March 2008 08:52

Re: Tab based Latest News Block - advance skills needed!

Post by frold » 25. May 2008 20:55

thomas.d wrote:Wow, that's cool frold!
Thank you :D

And it use the build in tab function in phpBB3 - so no extra javascript is needed :D
http://www.studmed.dk - Portal for doctors and medical students in Denmark

User avatar

Kevin
Site Admin
Site Admin
Posts: 2888
Joined: 7. January 2006 21:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg

Re: Tab based Latest News Block - advance skills needed!

Post by Kevin » 25. May 2008 21:53

Yar, pretty and interesting idea! Image

But could be hard to make it valid. ;)
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!


Topic author
frold
Portal Enthusiast
Portal Enthusiast
Posts: 108
Joined: 24. March 2008 08:52

Re: Tab based Latest News Block - advance skills needed!

Post by frold » 25. May 2008 21:57

Kevin wrote:But could be hard to make it valid. ;)
Dont see any bugs related to the news block....
http://www.studmed.dk - Portal for doctors and medical students in Denmark

User avatar

Kevin
Site Admin
Site Admin
Posts: 2888
Joined: 7. January 2006 21:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg

Re: Tab based Latest News Block - advance skills needed!

Post by Kevin » 25. May 2008 22:02

I haven't taken a deeper look. Just my experience with the classes of prosilver (and this is why i'm so glad about our own css in the next version). ;)
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!

User avatar

liquidspark
Translator
Translator
Posts: 27
Joined: 10. February 2008 18:11
Location: New Jersey, USA

Re: Tab based Latest News Block - advance skills needed!

Post by liquidspark » 7. June 2008 04:46

This isn't working for me:

http://usa.sonataforum.com

You can see the errors there. Please note that this is a live environment, so I'd appreciate help ASAP. :?

User avatar

CocoVFR
Active Member
Active Member
Posts: 19
Joined: 3. May 2008 02:50

Re: Tab based Latest News Block - advance skills needed!

Post by CocoVFR » 7. June 2008 18:45

Hello Frold. I've the same error than above:

Code: Select all

[phpBB Debug] PHP Notice: in file /portal/includes/functions.php on line 74: Missing argument 6 for phpbb_fetch_posts()

Retourner à l’index du forum 
Erreur générale
SQL ERROR [ mysql4 ]

Erreur de syntaxe pr?s de 'JOIN phpbb_forums as f ON t.forum_id=f.forum_id ' ? la ligne 33 [1064]

SQL

SELECT t.forum_id, t.topic_id, t.topic_last_post_id, t.topic_last_post_time, t.topic_time, t.topic_title, t.topic_attachment, t.topic_views, t.poll_title, t.topic_replies, t.topic_poster, u.username, u.user_id, u.user_type, u.user_colour, p.post_id, p.post_time, p.post_text, p.post_attachment, p.enable_smilies, p.enable_bbcode, p.enable_magic_url, p.bbcode_bitfield, p.bbcode_uid, f.forum_name FROM phpbb_topics AS t LEFT JOIN phpbb_users as u ON LEFT JOIN phpbb_forums as f ON t.forum_id=f.forum_id LEFT JOIN phpbb_posts as p ON WHERE AND t.topic_status <> 2 AND t.topic_approved = 1 AND t.topic_moved_id = 0 ORDER BY LIMIT 250

BACKTRACE


FILE: includes/db/mysql.php
LINE: 158
CALL: dbal_mysql->sql_error()

FILE: includes/db/mysql.php
LINE: 205
CALL: dbal_mysql->sql_query()

FILE: includes/db/dbal.php
LINE: 159
CALL: dbal_mysql->_sql_query_limit()

FILE: portal/includes/functions.php
LINE: 228
CALL: dbal_mysql->sql_query_limit()

FILE: portal/block/tabnews.php
LINE: 36
CALL: phpbb_fetch_posts()

FILE: portal.php
LINE: 223
CALL: include('portal/block/tabnews.php')
But for me, it's on my dev environment...

User avatar

liquidspark
Translator
Translator
Posts: 27
Joined: 10. February 2008 18:11
Location: New Jersey, USA

patchup, but no fix

Post by liquidspark » 7. June 2008 19:50

I got the forum to display again (minus a working tabbed news block) by:

Opening /portal/includes/functions.php

-comment out -- use /* and */ -- lines 153 to 232 (from "if($type..." to "//Instantiate BBCode...")
-on line 74, delete: $type, .

That allowed me to display my board again, but the tabs aren't showing any news ('cause i commented out the SQL requests, which were creating an error anyway.)

Please help us fix this error.


Blauer Klaus
Active Member
Active Member
Posts: 7
Joined: 8. May 2008 07:16

Re: Tab based Latest News Block - advance skills needed!

Post by Blauer Klaus » 10. June 2008 07:01

Hi,

i got the same Error Messages but the Tip dont work.

:?: klaus


Topic author
frold
Portal Enthusiast
Portal Enthusiast
Posts: 108
Joined: 24. March 2008 08:52

Re: Tab based Latest News Block - advance skills needed!

Post by frold » 10. June 2008 07:43

Well to you all did you change tabnews.php

Like

Code: Select all

$portal_config['portal_news_forum_tab2'] = '1, 2 ,3'; //Here you type in the forum_id af the forum you want to get the latest news from when pressing the tab. If you type in more forum they have to be comma separated
So there is the id's on forum you have... offcause it will not work if you dont have a forum with eg id=3
http://www.studmed.dk - Portal for doctors and medical students in Denmark

User avatar

liquidspark
Translator
Translator
Posts: 27
Joined: 10. February 2008 18:11
Location: New Jersey, USA

Re: Errors

Post by liquidspark » 10. June 2008 18:02

Yes, I specified the forum IDs.

User avatar

CocoVFR
Active Member
Active Member
Posts: 19
Joined: 3. May 2008 02:50

Re: Tab based Latest News Block - advance skills needed!

Post by CocoVFR » 15. June 2008 15:36

UP :D


Topic author
frold
Portal Enthusiast
Portal Enthusiast
Posts: 108
Joined: 24. March 2008 08:52

Re: Tab based Latest News Block - advance skills needed!

Post by frold » 15. June 2008 17:29

CocoVFR wrote:UP :D
?

Did it work for you...?

Doesnt it work for any one? If so, then feel free to lock this post.....
http://www.studmed.dk - Portal for doctors and medical students in Denmark

User avatar

Kevin
Site Admin
Site Admin
Posts: 2888
Joined: 7. January 2006 21:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg

Re: Tab based Latest News Block - advance skills needed!

Post by Kevin » 15. June 2008 17:52

Better to make it work for anyone, rather than locking this thread!?
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!

Return to “board3 Portal v1.0.x - Modifications in Dev”