Tab based Latest News Block - advance skills needed!
Posted: 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
EXPLAINING THE CODE ABOVE CAUSE YOU NEED TO EDIT IT TO FIT YOUR NEEDS
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.
Here you type in the panel name that have to be pre-selected
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:
to eg
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 in the code used for tab2 its - see the system
OPEN
portal.php
AFTER ADD
OPEN
styles/prosilver/template/portal/portal_body.html
FIND
REPLACE WITH
CREATE
portal/block/tabnews.php
REPLACE ALL WITH
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.
The blocks are differents like: for tab2 where it would be in the phpcode for tab3 etc.
You have to change:
Where 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!
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" />
Code: Select all
var panels = new Array('tab1-panel', 'tab2-panel', 'tab3-panel', 'tab4-panel', 'tab5-panel', 'tab6-panel', 'tab7-panel');
Code: Select all
var show_panel = 'tab1-panel';
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>
You may want to change the tab names. You need to edit:
Code: Select all
<span>Tab 2</span>
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>
Code: Select all
news_row_tab1
Code: Select all
news_row_tab2
OPEN
portal.php
Code: Select all
if ($portal_config['portal_change_style'])
{
include($phpbb_root_path . 'portal/block/change_style.'.$phpEx);
}
Code: Select all
include($phpbb_root_path . 'portal/block/tabnews.'.$phpEx);
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 -->
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,
));
}
}
?>
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,
));
}
}
Code: Select all
$fetch_news_tab2
Code: Select all
$fetch_news_tab3
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
Code: Select all
'1, 2 ,3'
Congrates you now have a tab-based menu!