The newest registered user is Menupanda
Our users have posted a total of 44841 messages in 6606 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
» Reports of multiple victims in shooting at UNLV in Las Vegas; suspect dead
» 10 NEW TOPICS ADDED
» FORUM FOR MEMBERS TO POST NEW TOPICS OR APPS
» SEE WHAT YOU'RE MISSING
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
Yesterday at 4:27 pm by Paul
» COSPLAY...2
Yesterday at 4:22 pm by Paul
» WEATHER...3
Yesterday at 4:18 pm by Paul
» HISTORY FACTS * How people escaped past the Berlin Wall *
Yesterday at 3:52 pm by Paul
» US TRIVIA QUIZ * Which of these sports was invented by a YMCA teacher? *
Yesterday at 3:44 pm by Paul
» US TRIVIA ANSWER PAGE
Yesterday at 3:44 pm by Paul
» MAY NATIONAL CELEBRATION DAYS MAY 8 2024
Yesterday at 3:38 pm by Paul
» MAY NATIONAL CELEBRATION DAYS MAY 7 2024
Tue 07 May 2024, 5:41 am by Paul
» AWE WITTLE PUPPIES BUNNIES & KITTIES...5
Mon 06 May 2024, 6:48 pm by Paul
» GIRL FISHING...2
Mon 06 May 2024, 6:24 pm by Paul
» GIRL FISHING
Mon 06 May 2024, 6:23 pm by Paul
» HISTORY FACTS *Which President was at Lincoln's funeral? *
Mon 06 May 2024, 7:25 am by Paul
» MAY NATIONAL CELEBRATION DAYS MAY 6 2024
Mon 06 May 2024, 7:12 am by Paul
» AS ETASKI * Etaski just shared: "Eris Book Sale Today Only! My Website Status, etc." *
Sun 05 May 2024, 9:00 am by Paul
» HISTORY FACTS * The strangest recipients of WWII medals *
Sun 05 May 2024, 5:24 am by Paul