The newest registered user is Menupanda
Our users have posted a total of 44901 messages in 6618 subjects
WORLD CLOCK
Add news topics from multiple forums
Valley of the Sun Casual Club :: TODAY'S TECHNOLOGY TIPS FROM THE DOCTOR OF TECHNOLOGY AZDEWARS 143 TOPICS inside :: FORUM OF HOW TO'S 43 topics
Add news topics from multiple forums
Add news topics from multiple forums
by Ange Tuteur on Sun 19 Oct 2014, 06:07The current news widget only allows you to display topics from 1 subforum only. With this you should be able to display them from as many forums as you want ! Due note that getting topics from too many forums could cause you to hit the request limit, so use this in moderation ..! The HTML present in the script is only style for PHPBB3, this will have to be changed for other versions, but should still work.
Go to : Administration Panel > Modules > JavaScript codes management > Create a new script
Title : Your choice
Placement : In all the pages
Paste the code below :
CODE:SELECT CONTENT
- Code:
$(function() {
newsWidget('left', 1, 3, 12);
newsWidget('left', 2, 3, 413);
function newsWidget(column, forum, topics, special_id) {
if (localStorage.getItem('newsMod-'+special_id) && localStorage.getItem('newsExp-'+special_id) > +new Date - 4*60*1000) {
$('#'+column).append('<div id="news-'+special_id+'"><span class="hiddenItems" style="display:none"></span></div>');
$('#news-'+special_id).html(localStorage.getItem('newsMod-'+special_id));
return;
}
$('#'+column).append('<div id="news-'+special_id+'"><span class="hiddenItems" style="display:none"></span></div>');
$('#news-'+special_id+' .hiddenItems').load('/feed/?f='+forum+' item:lt('+topics+')', function() {
var it = 0;
while (it < topics) {
$('#news-'+special_id).append('<div class="module mod_news newsBox'+it+'"><div class="inner"><span class="corners-top"><span></span></span><div class="h3"></div><p class="dateAuthor"></p><span class="content"></span><p class="row3"></p><span class="corners-bottom"><span></span></span></div></div>');
it += 1
}
$('#news-'+special_id+' .hiddenItems item').each(function(){
var box = '.newsBox'+$(this).index();
$('#news-'+special_id + ' ' + box + ' .h3').html($(this).find('title').text()).wrap('<a href="'+$(this).find('guid').text()+'">');
$('#news-'+special_id + ' ' + box + ' .content').html($(this).find('description').text());
$('#news-'+special_id + ' ' + box + ' .row3').html('<a href="'+$(this).find('comments').text()+'">View comments</a>');
$('#news-'+special_id + ' ' + box + ' .dateAuthor').html($(this).find('pubdate').text() + ' by <strong>' + $(this).find('dc\\:creator').text() + '</strong>');
});
if (window.localStorage) {
localStorage.setItem('newsMod-'+special_id, $('#news-'+special_id).html());
localStorage.setItem('newsExp-'+special_id, +new Date)
}
});
}
});
To add new News widgets write : newsWidget(column, forum, topics, special_id)
Explained :
column : The column you want them to appear in ( left or right ) LOWERCASE ONLY
forum : The ID of the forum you want to load e.g. http://help.forumotion.com/f1-updates-and-new-features = f1 - f = 1
topics : The amount of topics you want to load (1, 2, 3, 4..)
special_id : It is important you use a UNIQUE ID for each news you add. It can be random numbers or letters, but make sure they are not identical.
You can modify the two I have in the script above already. To add more simply copy and paste them after. Example :
CODE:SELECT CONTENT
[/size]
- Code:
newsWidget('left', 1, 3, 12);
newsWidget('left', 2, 3, '41h3');
newsWidget('left', 4, 3, 4123);
newsWidget('left', 7, 3, 4113);
Note : The topics loaded are cached for 5 minutes to prevent multiple requests.[/size]
Paul
Please enjoy
_________________
May the SUN always be with you
home of
https://www.valleyofthesuncc.com/ an information and entertainment only website
» IN THE LOCAL NEWS...3
» THE FUNDAMENTALIST and more topics
» 10 NEW TOPICS ADDED
» FORUM FOR MEMBERS TO POST NEW TOPICS OR APPS
Valley of the Sun Casual Club :: TODAY'S TECHNOLOGY TIPS FROM THE DOCTOR OF TECHNOLOGY AZDEWARS 143 TOPICS inside :: FORUM OF HOW TO'S 43 topics
Today at 6:06 am by Paul
» WebMD * How to Get Rid of Blue Balls *
Today at 6:02 am by Paul
» MEME OOH LALA..36
Today at 12:31 am by Paul
» MEMEALTON...3
Today at 12:03 am by Paul
» OPTICAL ILLUSIONS 3 abstract art
Yesterday at 1:15 pm by Paul
» MAY 11 CATRINA'S BIRTHDAY
Yesterday at 12:02 pm by Paul
» INTRO TO VOTS CURRENT & SPECIAL EVENTS FORUM & BILLBOARD
Yesterday at 11:43 am by Paul
» MAY NATIONAL CELEBRATION DAYS MAY 10 2024
Yesterday at 8:49 am by Paul
» YOU TUBE SHORTS DANCE ONLY...2
Yesterday at 7:05 am by Paul
» AWESOME SPORTS GIF's...7
Yesterday at 7:04 am by Paul
» YOUTUBE SHORTS WWE...22
Yesterday at 7:04 am by Paul
» BRIGHT SIDE...3
Yesterday at 7:02 am by Paul
» WWE WHO's WHO ?
Yesterday at 6:54 am by Paul
» YOUTUBE SHORTS WWE...21
Yesterday at 6:52 am by Paul
» US TRIVIA QUIZ * What cut of meat is often considered the "National Dish of Texas"? *
Yesterday at 6:40 am by Paul