FM Design
Would you like to react to this message? Create an account in a few clicks or log in to continue.

IMPORTANT

FM Design is in read-only mode, please click here for more information.

Latest topics
» Forumactif Edge - Releases
by Ange Tuteur Tue 03 Sep 2019, 11:49

» GIFActif - Giphy Button for the Editor
by Ange Tuteur Wed 08 May 2019, 17:21

» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28

» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15

» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11

» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24

» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58

» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50

» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22

» GeekPolice Tech Support Forums - GeekPolice.net
by Dr Jay Mon 11 Dec 2017, 19:12

» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10

» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51

» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11

» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19

» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34

Recent Tutorials
Top posting users this month

Who is online?
In total there are 20 users online :: 0 Registered, 0 Hidden and 20 Guests :: 1 Bot

None

[ View the whole list ]


Most users ever online was 515 on Tue 14 Sep 2021, 15:24

Add news topics from multiple forums

View previous topic View next topic Go down

Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12013
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Sun 19 Oct 2014, 06:07

This is a test ! Bugs may be present and if found, should be reported to this topic !!

The 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:
$(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:
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.


Enjoy and thanks in advance for feedback. Smile


Last edited by Ange Tuteur on Wed 22 Oct 2014, 17:59; edited 1 time in total
Michael_vx
Michael_vx

Gender : Male
Age : 32
Posts : 302
Points : 4066
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx Sun 19 Oct 2014, 11:29

hi ange 1st thanks for this great Idea of Script
looks no bugs with me
apper on the top of page
but only the 5 minutes cach is might be alittle problem
i changed the the forum ID but still show the old ID
would you please if you dont mind tell me how to change the cach time ?
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12013
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Sun 19 Oct 2014, 21:55

Oh, yes ! you can change that here in the script :
Code:
4*60*1000
It's minutes*seconds*miliseconds

Right now is 5 minutes ^^
Michael_vx
Michael_vx

Gender : Male
Age : 32
Posts : 302
Points : 4066
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx Tue 21 Oct 2014, 19:44

i feel something still not right
i changed the ID to 18 but still show the topics from the ID 1
and may i know why it on the top of my forum Very Happy
thanks again
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12013
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Wed 22 Oct 2014, 17:58

Have you made sure to change the forum ID, of the forum you're loading the topics from ? Make sure to change the special ID to something different as well, otherwise the cached data will be applied to it. Wink

newsWidget('left', 1, 3, 2353);

Forum ID is red.
Special ID is green.
Michael_vx
Michael_vx

Gender : Male
Age : 32
Posts : 302
Points : 4066
Reputation : 76
Language : Arabic
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : Other
http://miccsoft.net https://www.facebook.com/Michaelvx2008

PostMichael_vx Sat 25 Oct 2014, 02:18

Ange Tuteur wrote:
This is a test ! Bugs may be present and if found, should be reported to this topic !!
i dont feel any bug its only need to be good changed i mean
its the use of it and the changes will made
the last thing i like to say is how to control the placement like if i add it to the right side it wont work for me because it must be 2 widget under the widget that make all widgets at the end of forum if not
it will be ruined with the forum looks
and i hope you made that inside topics soon
like how you made the facebook in topics
i like to share something could help you change this code to be in topic
Code:

var CopyrightNotice='The last Topics category for forumotion. Copyright By Micsoft';

    $(function () {

        $.ajax({

            url: "/feed/?f={FORUM_ID}",

            success: function (a) {

  

              $(".postbody:first").after('<div

    class="clear"></div><div

    class="clear"></div><div

    class="clear_both"></div><div

    style="width:90%;background:#eee;border:1px solid

    #ddd;padding:4px;margin-top:5px;"><br /><DIV style="BORDER-BOTTOM: #ddd 1px solid; BORDER-LEFT: #ddd 1px solid; PADDING-BOTTOM: 10px; PADDING-LEFT: 20px; PADDING-RIGHT: 20px; BACKGROUND: #fff; BORDER-TOP: #ddd 1px solid; FONT-WEIGHT: bold; BORDER-RIGHT: #ddd 1px solid; PADDING-TOP: 10px" id=cungchuyenmuc sizcache033358950495445="13" sizset="51">

    <DIV class=title sizcache033358950495445="13" sizset="51"><IMG src="http://i57.servimg.com/u/f57/18/31/15/78/812.gif"></DIV>');

                12 < $(a).find("title").length ? so = 12 : so = $(a).find("title").length;

  

              for (i = 2; i < so; i++) $('<a href="' +

    $(a).find("link:eq(" + i + ")").text() + '">' + $(a).find("title:eq("

    + i + ")").text() + "</a><br/>").appendTo("#cungchuyenmuc")

            }

        })

    });

this code from the whole forum only the new topics Smile but inside the 1st topic and if you could and make a code that show from the same subforum as topic this gonna blow the whole forumotion forums Very Happy
thanks again
Rhino.Freak
Rhino.Freak

Gender : Male
Age : 27
Posts : 275
Points : 4228
Reputation : 86
Location : India!
Language : English, Hindi
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
http://tokyoghoular.foruns.com.pt/

PostRhino.Freak Mon 27 Oct 2014, 10:42

this sounds pretty good!
On a similar note, is there any way to just DISALLOW 1 forum in the original latest topics widget?
coz that's what I aim (don't want to show basket posts in latest topics)
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12013
Reputation : 2375
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Tue 28 Oct 2014, 20:46

Rhino.Freak wrote:this sounds pretty good!
On a similar note, is there any way to just DISALLOW 1 forum in the original latest topics widget?
coz that's what I aim (don't want to show basket posts in latest topics)
Not that I know of. You could remove them, by loading the topic and checking its subforum, but that might be a bit heavy.
Sponsored content

PostSponsored content

View previous topic View next topic Back to top

Create an account or log in to leave a reply

You need to be a member in order to leave a reply.

Create an account

Join our community by creating a new account. It's easy!


Create a new account

Log in

Already have an account? No problem, log in here.


Log in

 
Permissions in this forum:
You cannot reply to topics in this forum