last topics from different subforums Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.
+2
Ange Tuteur
H.A.SS.A.N
6 posters

    last topics from different subforums

    H.A.SS.A.N
    H.A.SS.A.N
    Forumember


    Posts : 77
    Reputation : 1
    Language : Arabic

    Solved last topics from different subforums

    Post by H.A.SS.A.N September 30th 2015, 3:59 pm

    hi friends
    I need code for make wigdet to bring last topic from different subforums
    at least 1 topic from each subforum when I selected by ID of these subforums

    the code is similar to this http://fmdesign.forumotion.com/t229-add-news-topics-from-multiple-forums
    but I need to maintain the orginal news-wigdet and make another wigdet contain news from other subforums
    I hope to help me
    thank u


    Last edited by H.A.SS.A.N on October 23rd 2015, 11:31 am; edited 1 time in total
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: last topics from different subforums

    Post by Ange Tuteur September 30th 2015, 7:05 pm

    Hi "H.A.SS.A.N",

    Would this tutorial be similar to what you're looking for ?
    https://help.forumotion.com/t129060-widget-recent-topics-of-a-specific-sub-forum#864372
    H.A.SS.A.N
    H.A.SS.A.N
    Forumember


    Posts : 77
    Reputation : 1
    Language : Arabic

    Solved Re: last topics from different subforums

    Post by H.A.SS.A.N October 1st 2015, 4:39 pm

    Thank you "Ange Tuteur"
    but I need the topics in the wigdet from different subforums (in one wigdet only) .
    from each subforum only last topic and for other subforums also
    mmmm I'm not sure if u understand what I want or not .
    I'm waiting u
    and Thank u
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: last topics from different subforums

    Post by Ange Tuteur October 1st 2015, 4:55 pm

    You should be able to do that with the tutorial I linked you. Instead of making multiple widgets, just make one with multiple news containers :
    Code:
    <div id="newsareal1" class="newsareal"> </div>
    <div id="newsareal2" class="newsareal"> </div>
    <div id="newsareal3" class="newsareal"> </div>
    <div id="newsareal4" class="newsareal"> </div>

    Then you just add the javascript to load the topics into each container :
    Code:
    jQuery(document).ready(function(){
    jQuery("#newsareal1").load("/f1- div.topic-title-container:lt(5)");
    jQuery("#newsareal2").load("/f2- div.topic-title-container:lt(5)");
    jQuery("#newsareal3").load("/f3- div.topic-title-container:lt(5)");
    jQuery("#newsareal4").load("/f4- div.topic-title-container:lt(5)");
    });

    For organization, you can add titles above each container.
    H.A.SS.A.N
    H.A.SS.A.N
    Forumember


    Posts : 77
    Reputation : 1
    Language : Arabic

    Solved Re: last topics from different subforums

    Post by H.A.SS.A.N October 1st 2015, 7:08 pm

    ok but can u add some edit on it please
    1- I want only 10 topic form different subforums ,, when there is new topic will to disappear the last topic
    in wigdet .
    2- I need top display avater of writer of topic and name ecaxtly as this https://help.forumotion.com/t141465-latest-tutorials-widget
    , I make some edit on it with css for my forum and make it as
    https://i.servimg.com/u/f21/19/09/87/49/untitl11.png
    I need it for show the last episodes add in some subforums 

    I'm waiting u , THANK U
    avatar
    darki
    Forumember


    Posts : 254
    Reputation : 10
    Language : German, english

    Solved Re: last topics from different subforums

    Post by darki October 2nd 2015, 2:47 pm

    H.A.SS.A.N wrote:2- I need top display avater of writer of topic and name ecaxtly as this https://help.forumotion.com/t141465-latest-tutorials-widget
    @Ange Tuteur
    I'm interested in this aswell.

    Also it would be fantastic, if the author and date/time would appear (like in the normal widget for recent topics).
    H.A.SS.A.N
    H.A.SS.A.N
    Forumember


    Posts : 77
    Reputation : 1
    Language : Arabic

    Solved Re: last topics from different subforums

    Post by H.A.SS.A.N October 3rd 2015, 11:35 am

    bump
    H.A.SS.A.N
    H.A.SS.A.N
    Forumember


    Posts : 77
    Reputation : 1
    Language : Arabic

    Solved Re: last topics from different subforums

    Post by H.A.SS.A.N October 3rd 2015, 7:09 pm

    please ???
    no answer ??
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51497
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: last topics from different subforums

    Post by SLGray October 3rd 2015, 7:39 pm

    H.A.SS.A.N wrote:bump

    H.A.SS.A.N wrote:please ???
    no answer ??
    Please don't double post. Your post needs to be separated by at least 24 hours before bumping. Please use the edit button instead!



    last topics from different subforums Slgray10

    When your topic has been solved, ensure you mark the topic solved.
    Never post your email in public.
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: last topics from different subforums

    Post by Ange Tuteur October 3rd 2015, 7:52 pm

    @H.A.SS.A.N, before I start, which version forum are you using ? phpbb2, phpbb3, punbb, or invision ?
    H.A.SS.A.N
    H.A.SS.A.N
    Forumember


    Posts : 77
    Reputation : 1
    Language : Arabic

    Solved Re: last topics from different subforums

    Post by H.A.SS.A.N October 4th 2015, 2:33 pm

    @SLGray
    I' so sorry ^_^
    H.A.SS.A.N
    H.A.SS.A.N
    Forumember


    Posts : 77
    Reputation : 1
    Language : Arabic

    Solved Re: last topics from different subforums

    Post by H.A.SS.A.N October 4th 2015, 2:37 pm

    hello @"Ange Tuteur "
    I need it for phpbb2 and phpbb3 also .
    if u can't make one code for two version , u can make one code for every version ??
    I'm waiting u
    Thank u
    H.A.SS.A.N
    H.A.SS.A.N
    Forumember


    Posts : 77
    Reputation : 1
    Language : Arabic

    Solved Re: last topics from different subforums

    Post by H.A.SS.A.N October 6th 2015, 2:33 pm

    pumb
    H.A.SS.A.N
    H.A.SS.A.N
    Forumember


    Posts : 77
    Reputation : 1
    Language : Arabic

    Solved Re: last topics from different subforums

    Post by H.A.SS.A.N October 9th 2015, 5:36 pm

    pumb
    avatar
    darki
    Forumember


    Posts : 254
    Reputation : 10
    Language : German, english

    Solved Re: last topics from different subforums

    Post by darki October 10th 2015, 10:50 am

    Ange Tuteur wrote:@H.A.SS.A.N, before I start, which version forum are you using ? phpbb2, phpbb3, punbb, or invision ?
    @Ange Tuteur I'm interested in this aswell and I'm using phpbb3.
    Also it would be fantastic, if the author and date/time would appear (like in the normal widget for recent topics).
    If that is not possible, an answer would great. Smile
    alla13
    alla13
    Forumember


    Posts : 91
    Reputation : 6
    Language : Arab5/5 Eng3/5 Fr2/5

    Solved Re: last topics from different subforums

    Post by alla13 October 10th 2015, 11:31 am

     I'm interested in this 
    i hope you make it for phpp2
    H.A.SS.A.N
    H.A.SS.A.N
    Forumember


    Posts : 77
    Reputation : 1
    Language : Arabic

    Solved Re: last topics from different subforums

    Post by H.A.SS.A.N October 11th 2015, 5:27 pm

    pumb
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: last topics from different subforums

    Post by Ange Tuteur October 12th 2015, 1:40 pm

    Hi,

    Sorry for the wait, I've been busy. Add the following to your stylesheet :
    Code:
    .last-ajax-posts {
      font-size:13px;
      font-family:Arial, Verdana, Sans-serif;
    }

    Then go to Modules > JavaScript codes management and create a new script

    Placement : In all the pages
    Code:
    window._getNewest = function(o) {
      if (!o.node) return false;
      if (!o.forum) o.forum = 1;

      if (!o.amount) o.amount = 5;

      o.node = document.getElementById(o.node);

      if (o.node) {
        $.get('/f' + o.forum + '-?change_version=prosilver', function(d) {
          var last = $('.row .lastpost:has(a[href^="/t"])', d), content = document.createElement('DIV'), i = 0;
         
          for (; i < o.amount; i++) {
            if (!last[i]) break;
            else content.appendChild(last[i]);
          }

          o.node.appendChild(content);
        });
      }
    };


    After this, you can add the following to widget :
    Code:
    <div id="topicbox-1" class="last-ajax-posts"></div>

    <script type="text/javascript">
    _getNewest({
      forum : 1,
      amount : 3,
      node : 'topicbox-1'
    });
    </script>

    If you're going to have multiple boxes, make sure to replace the 1 in topicbox-1 by another number. At the bottom are some settings :

    forum : The ID of the forum you want the topics from.
    amount : The amount of topics you want to get.
    node : The ID of the container you want to load the topics into.

    To style any of the content, just use the following selector(s) :
    Code:
    .last-ajax-posts .lastpost {

    }
    ( that is for the container of each topic )

    If you have the avatars for lastposts enabled under Display > Structure and Hierarchy, the avatars will also display in this widget. The rest is up to you. Wink
    H.A.SS.A.N
    H.A.SS.A.N
    Forumember


    Posts : 77
    Reputation : 1
    Language : Arabic

    Solved Re: last topics from different subforums

    Post by H.A.SS.A.N October 12th 2015, 2:59 pm

    Firstly Thank u for your time ^_^
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    ( o.forum = 1; + o.amount = 5; ) these only change or change ID number of forum in code of wigdet also ???
    and what's the way for add more than one forum , I mean that I need only 10 last topics come from specific forums those I selected in code .
    if this is possible in your code above give me the tip ^_^
    AND thank u very much for your time and work
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: last topics from different subforums

    Post by Ange Tuteur October 12th 2015, 3:07 pm

    You can paste this as much as you want :
    Code:
    <div id="topicbox-1" class="last-ajax-posts"></div>

    <script type="text/javascript">
    _getNewest({
      forum : 1,
      amount : 3,
      node : 'topicbox-1'
    });
    </script>

    HOWEVER you need to change the values for each one. Firstly, you should change both the numbers for topicbox-1 to a number that isn't used by an existing widget. Then you modify the forum ID to change the forum where you get the topics from :
    Code:
    forum : 1,

    Those are the three things you should focus on editing. Wink
    H.A.SS.A.N
    H.A.SS.A.N
    Forumember


    Posts : 77
    Reputation : 1
    Language : Arabic

    Solved Re: last topics from different subforums

    Post by H.A.SS.A.N October 12th 2015, 3:30 pm

    Ok , I will add the code and then I tell u with results
    ++ whats the maximum number of topics can I get it ???
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: last topics from different subforums

    Post by Ange Tuteur October 12th 2015, 3:38 pm

    However much you allow perpage on your forum. Wink

    You can see that via AP > General > Messages Config > Topics per page

    Keep in mind that the more you get the longer it will take to load them all. Neutral
    H.A.SS.A.N
    H.A.SS.A.N
    Forumember


    Posts : 77
    Reputation : 1
    Language : Arabic

    Solved Re: last topics from different subforums

    Post by H.A.SS.A.N October 12th 2015, 3:46 pm

    ok , hhhhhhhhhh Thank u
    Realy u are hero ^_^
    but is this code only for phpbb3 or also phpbb2 ??
    I noticed there is version=prosilver ??
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: last topics from different subforums

    Post by Ange Tuteur October 12th 2015, 3:50 pm

    It previews your forum in version phpbb3 when it sends the AJAX request, so the data returned is always accurate, regardless of version. The only difference is mostly in display.
    H.A.SS.A.N
    H.A.SS.A.N
    Forumember


    Posts : 77
    Reputation : 1
    Language : Arabic

    Solved Re: last topics from different subforums

    Post by H.A.SS.A.N October 12th 2015, 4:17 pm

    if I modified the default tamplate will not work correctly???
    not work with me ?
    I think because I modified the tampates
    H.A.SS.A.N
    H.A.SS.A.N
    Forumember


    Posts : 77
    Reputation : 1
    Language : Arabic

    Solved Re: last topics from different subforums

    Post by H.A.SS.A.N October 14th 2015, 2:43 pm

    pumb
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: last topics from different subforums

    Post by Ange Tuteur October 14th 2015, 2:44 pm

    H.A.SS.A.N wrote:if I modified the default tamplate will not work correctly???
    not work with me ?
    I think because I modified the tampates
    What's the URL of the forum you're having problems on ?
    H.A.SS.A.N
    H.A.SS.A.N
    Forumember


    Posts : 77
    Reputation : 1
    Language : Arabic

    Solved Re: last topics from different subforums

    Post by H.A.SS.A.N October 14th 2015, 4:24 pm

    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: last topics from different subforums

    Post by Ange Tuteur October 14th 2015, 6:57 pm

    For that forum, try changing the script in JS codes management to this :
    Code:
    window._getNewest = function(o) {
      if (!o.node) return false;
      if (!o.forum) o.forum = 1;

      if (!o.amount) o.amount = 5;

      o.node = document.getElementById(o.node);

      if (o.node) {
        $.get('/f' + o.forum + '-?change_version=prosilver', function(d) {
          var last = $('.alt1:has(.lastpost-avatar)', d), content = document.createElement('DIV'), i = 0;
         
          for (; i < o.amount; i++) {
            if (!last[i]) break;
            else content.appendChild(last[i]);
          }

          o.node.appendChild(content);
        });
      }
    };
    H.A.SS.A.N
    H.A.SS.A.N
    Forumember


    Posts : 77
    Reputation : 1
    Language : Arabic

    Solved Re: last topics from different subforums

    Post by H.A.SS.A.N October 15th 2015, 6:55 am

    can edit the code for these topic http://www.a7la-anime.com/f196-montada
    because I need it for blog topic
    and Thank U