The newest registered user is mark5
Our users have posted a total of 48862 messages in 7215 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
» MOST VIEWED TOPICS
» THE FUNDAMENTALIST and more topics
» 10 NEW TOPICS ADDED
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
Tue 19 Nov 2024, 11:51 pm by Paul
» *POPULAR CONTENTS* Valley of the SUN Official Newsletter
Tue 19 Nov 2024, 6:45 am by Paul
» Disneyland vacation
Tue 19 Nov 2024, 6:37 am by Paul
» WGT POETRY , QUOTES , MOMENTS , & MORE
Mon 18 Nov 2024, 9:48 am by Paul
» Word Genius Word of the day * Spindrift *
Mon 18 Nov 2024, 6:45 am by Paul
» Tales of Miurag #3 in Paperback Patreon Story in December!
Mon 18 Nov 2024, 5:33 am by Paul
» Download WhatsApp
Sun 10 Nov 2024, 5:39 am by mark5
» WORD DAILY Word of the Day: * Saponaceous *
Sat 09 Nov 2024, 8:57 am by Paul
» Word Genius Word of the day * Infracaninophile *
Thu 07 Nov 2024, 9:03 am by Paul
» THE TRUMP DUMP .....
Wed 06 Nov 2024, 4:30 am by Paul
» INTERESTING FACTS * How do astronauts vote from space? *
Tue 05 Nov 2024, 8:47 am by Paul
» WWE Crown Jewel is almost here! Don't miss the action LIVE today only on Peacock!
Sat 02 Nov 2024, 7:59 am by Paul
» NEW GUEST COUNTER
Fri 01 Nov 2024, 6:56 pm by Paul
» Merriam - Webster Word of the day * ‘Deadhead’ *
Fri 01 Nov 2024, 5:35 pm by Paul
» WWE Universe: Your Crown Jewel Broadcast Schedule has arrived!
Fri 01 Nov 2024, 1:38 pm by Paul