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.

Adding "New Post" to Multi Forums in One

2 posters

Go down

Solved Adding "New Post" to Multi Forums in One

Post by Guest October 23rd 2015, 1:10 pm

Technical Details

Forum version : #phpBB2
Position : Founder
Concerned browser(s) : Google Chrome
Screenshot of problem : https://i.servimg.com/u/f21/18/90/00/84/screen10.jpg
Who the problem concerns : All members
Forum link : http://draxgd.forumotion.com

Description of problem

My only question is can I place an actual "New Post", "No New Post" Image like I have in the actual forums (shown in blue) in the Multi Forums In One part (showing in white), instead of a simple image? Any help or advice would be greatly appreciated. Thanks!


Last edited by Draxion on October 28th 2015, 11:18 am; edited 1 time in total
avatar
Guest
Guest


Back to top Go down

Solved Re: Adding "New Post" to Multi Forums in One

Post by Ape October 23rd 2015, 2:05 pm

It should change when there is a post and it has been read the settings are set to the same as the forum in all topic's


Adding "New Post" to Multi Forums in One Left1212Adding "New Post" to Multi Forums in One Center11Adding "New Post" to Multi Forums in One Right112
Adding "New Post" to Multi Forums in One Ape_b110
Adding "New Post" to Multi Forums in One Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 19084
Reputation : 1988
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Adding "New Post" to Multi Forums in One

Post by Guest October 23rd 2015, 10:49 pm

When I made the Multi Forums in one from the tutorial provided here, it just said to put images in that spot. They don't change when there is a new post since they're plain images. I was wondering if there was a way to place the same function there like the other forums.

I have tested it too and they didn't change when a new post was posted.
avatar
Guest
Guest


Back to top Go down

Solved Re: Adding "New Post" to Multi Forums in One

Post by Ange Tuteur October 24th 2015, 1:27 am

Unfortunately that's one of the drawbacks to using this method. It doesn't include the normal logic, instead only the row which corresponds to the single forum will change based on its state. You can use JavaScript to send a request to each forum to check for new topics, but it can be a little heavy depending on how many forums need to be checked.. Think
Ange Tuteur
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Adding "New Post" to Multi Forums in One

Post by Guest October 24th 2015, 1:30 am

Well the only forums I want to be effected by the "New Post" images is the ones I have displayed on the index page - total of 14. If that is possible.
avatar
Guest
Guest


Back to top Go down

Solved Re: Adding "New Post" to Multi Forums in One

Post by Guest October 25th 2015, 6:56 am

Bump
avatar
Guest
Guest


Back to top Go down

Solved Re: Adding "New Post" to Multi Forums in One

Post by Guest October 26th 2015, 10:43 am

Bump
avatar
Guest
Guest


Back to top Go down

Solved Re: Adding "New Post" to Multi Forums in One

Post by Guest October 27th 2015, 11:52 am

Bump
avatar
Guest
Guest


Back to top Go down

Solved Re: Adding "New Post" to Multi Forums in One

Post by Ange Tuteur October 27th 2015, 12:01 pm

Hi @Draxion,

Sorry for the delay, but could you post the table code(s) here ? I'll need to setup some classes so it's easier to manipulate via JavaScript.
Ange Tuteur
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Adding "New Post" to Multi Forums in One

Post by Guest October 27th 2015, 12:03 pm

Of course, thank you!

8 Blocks
Code:
<table style="width: 100%;" cellpadding="2" cellspacing="2" border="0">
                                  
   <tbody>
      <tr>
                                
         <td style="width: 4%;">
                      <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />         
         </td>
                                
         <td style="width: 46%;">
                      <strong><a href="http://draxgd.forumotion.com/f71-dsfds">Introductions & Goodbyes</a></strong><br />This is where users can introduce themselves to the D&D Community. Also where they can let others know of their absence.<br />         
         </td>
                                
         <td style="width: 4%;">
                      <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />         
         </td>
                                
         <td style="width: 46%;">
                      <strong><a href="http://draxgd.forumotion.com/f72-dfsf">News & Announcements </a></strong><br />This is where all the news and announcements from the site will be held and stored.<br />         
         </td>
                              
      </tr>
                           
      <tr>
                                
         <td>
                      <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />         
         </td>
                                
         <td>
                      <strong><a href="http://draxgd.forumotion.com/f73-asdf">FAQ's</a></strong><br />This is where players can ask questions to the D&D Community. Experienced players can also answer questions. Simply "create" a new topic with your question as the title. In the message box explain everything you can to help answer the question.<br />         
         </td>
                                
         <td>
                      <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />         
         </td>
                                
         <td>
                      <strong><a href="http://draxgd.forumotion.com/f74-fdsa">Help & Support</a></strong><br />Please post here if you're having troubles with the site: accounts, logging in, discovered bugs, and so forth.<br /><br />Guests can report here as well.<br />         
         </td>
                              
      </tr>
                           
      <tr>
                                
         <td>
                      <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />         
         </td>
                                
         <td>
                      <strong><a href="http://draxgd.forumotion.com/f75-eqwe">Guides on Character Generation</a></strong><br />This is where much of the D&D stuff is kept: spells, skills, classes, races, feats, and help!<br /><br /><a href="http://draxgd.forumotion.com/f24-shops"><strong><span style="color: rgb(0, 255, 255);">D&D SHOPS</span></strong></a>         
         </td>
                                
         <td>
                      <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />         
         </td>
                                
         <td>
                      <strong><a href="http://draxgd.forumotion.com/f76-werwer">D&D Requests</a></strong><br />Name says it all. Here is where you can request certain things not currently inside the Dungeons and Dragons Game: Classes, races, special spells, skills, and so forth.<br />         
         </td>
                              
      </tr>
                           
      <tr>
                                
         <td>
                      <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />         
         </td>
                                
         <td>
                      <strong><a href="http://draxgd.forumotion.com/f77-ert">Graphic Designer's Section</a></strong><br />This is where everything related to the Graphic Designers will be located. Here, players can request such artwork from the designers.<br />         
         </td>
                                
         <td>
                      <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />         
         </td>
                                
         <td>
                      <strong><a href="http://draxgd.forumotion.com/f78-asdfv">Free Chat</a></strong><br />This is where everyone is free to speak freely, though keep it away from the D&D game. <br />         
         </td>
                              
      </tr>
                       
   </tbody>
</table>

6 Blocks
Code:
<table border="0" cellspacing="2" cellpadding="2" style="width: 100%;">
                    
   <tbody>
      <tr>
                      
         <td style="width: 5%;">
              <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />       
         </td>
                      
         <td style="width: 44%;">
                  <a href="http://draxgd.forumotion.com/f14-player-s-forum"><strong>Player's Forum</strong></a><br />This is where the players can access various threads for the D&D game: spell lists, dice rolls, and so forth.<br />   
         </td>
                      
         <td style="width: 6%;">
              <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />       
         </td>
                      
         <td style="width: 45%;">
                  <a href="http://draxgd.forumotion.com/f16-spell-lists"><strong>Spell Lists</strong></a><br />Pretty self-explanatory, this is where the player's spell lists are located.<br />   
         </td>
                    
      </tr>
                 
      <tr>
                      
         <td>
              <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />       
         </td>
                      
         <td>
                  <a href="http://draxgd.forumotion.com/f22-private-party-occ"><strong>Private Party OCC</strong></a><br />Self-explanatory, this is where parties can discuss among their teammates privately.<br />   
         </td>
                      
         <td>
              <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />       
         </td>
                      
         <td>
                  <a href="http://draxgd.forumotion.com/f53-affiliations"><strong>Affiliations</strong></a><br />This is where players can create their own affiliations (guilds, independent organizations, groups, etc). Fill out the <a href="http://draxgd.forumotion.com/t449-affiliation-applications">application</a> and then the DM can approve it.     
         </td>
                    
      </tr>
                 
      <tr>
                      
         <td>
              <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />       
         </td>
                      
         <td>
                  <a href="http://draxgd.forumotion.com/f54-character-biographies"><strong>Character Biographies</strong></a><br />Denser information on the characters can be found here. Please only one thread per character, thanks!<br />   
         </td>
                      
         <td>
              <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />       
         </td>
                      
         <td>
                  <a href="http://draxgd.forumotion.com/f65-dd-history"><strong>D&D History</strong></a><br />   
            <div style="text-align: center;">
                   This is where the historical data of the D&D game is held.   
            </div>
             
            <div style="text-align: center;">
                <br /> 
            </div>
                   
            <div style="text-align: center;">
                   <a href="http://draxgd.forumotion.com/t409-warning-read-first" style="font-size: 18px;">WARNING!!</a><br />   
            </div>
                   
         </td>
                    
      </tr>
             
   </tbody>
</table>
avatar
Guest
Guest


Back to top Go down

Solved Re: Adding "New Post" to Multi Forums in One

Post by Ange Tuteur October 27th 2015, 2:13 pm

Replace the 8 blocks with this :
Code:
<table style="width: 100%;" cellpadding="2" cellspacing="2" border="0">
                                 
  <tbody>
      <tr>
                               
        <td style="width: 4%;">
                      <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />         
        </td>
                               
        <td style="width: 46%;" class="mf-ajax">
                      <strong><a href="http://draxgd.forumotion.com/f71-dsfds">Introductions & Goodbyes</a></strong><br />This is where users can introduce themselves to the D&D Community. Also where they can let others know of their absence.<br />         
        </td>
                               
        <td style="width: 4%;">
                      <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />         
        </td>
                               
        <td style="width: 46%;" class="mf-ajax">
                      <strong><a href="http://draxgd.forumotion.com/f72-dfsf">News & Announcements </a></strong><br />This is where all the news and announcements from the site will be held and stored.<br />         
        </td>
                             
      </tr>
                           
      <tr>
                               
        <td>
                      <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />         
        </td>
                               
        <td class="mf-ajax">
                      <strong><a href="http://draxgd.forumotion.com/f73-asdf">FAQ's</a></strong><br />This is where players can ask questions to the D&D Community. Experienced players can also answer questions. Simply "create" a new topic with your question as the title. In the message box explain everything you can to help answer the question.<br />         
        </td>
                               
        <td>
                      <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />         
        </td>
                               
        <td class="mf-ajax">
                      <strong><a href="http://draxgd.forumotion.com/f74-fdsa">Help & Support</a></strong><br />Please post here if you're having troubles with the site: accounts, logging in, discovered bugs, and so forth.<br /><br />Guests can report here as well.<br />         
        </td>
                             
      </tr>
                           
      <tr>
                               
        <td>
                      <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />         
        </td>
                               
        <td class="mf-ajax">
                      <strong><a href="http://draxgd.forumotion.com/f75-eqwe">Guides on Character Generation</a></strong><br />This is where much of the D&D stuff is kept: spells, skills, classes, races, feats, and help!<br /><br /><a href="http://draxgd.forumotion.com/f24-shops"><strong><span style="color: rgb(0, 255, 255);">D&D SHOPS</span></strong></a>         
        </td>
                               
        <td>
                      <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />         
        </td>
                               
        <td class="mf-ajax">
                      <strong><a href="http://draxgd.forumotion.com/f76-werwer">D&D Requests</a></strong><br />Name says it all. Here is where you can request certain things not currently inside the Dungeons and Dragons Game: Classes, races, special spells, skills, and so forth.<br />         
        </td>
                             
      </tr>
                           
      <tr>
                               
        <td>
                      <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />         
        </td>
                               
        <td class="mf-ajax">
                      <strong><a href="http://draxgd.forumotion.com/f77-ert">Graphic Designer's Section</a></strong><br />This is where everything related to the Graphic Designers will be located. Here, players can request such artwork from the designers.<br />         
        </td>
                               
        <td>
                      <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />         
        </td>
                               
        <td class="mf-ajax">
                      <strong><a href="http://draxgd.forumotion.com/f78-asdfv">Free Chat</a></strong><br />This is where everyone is free to speak freely, though keep it away from the D&D game. <br />         
        </td>
                             
      </tr>
                       
  </tbody>
</table>


and the 6 blocks with this :
Code:
<table border="0" cellspacing="2" cellpadding="2" style="width: 100%;">
                   
  <tbody>
      <tr>
                     
        <td style="width: 5%;">
              <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />       
        </td>
                     
        <td style="width: 44%;" class="mf-ajax">
                  <a href="http://draxgd.forumotion.com/f14-player-s-forum"><strong>Player's Forum</strong></a><br />This is where the players can access various threads for the D&D game: spell lists, dice rolls, and so forth.<br />   
        </td>
                     
        <td style="width: 6%;">
              <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />       
        </td>
                     
        <td style="width: 45%;" class="mf-ajax">
                  <a href="http://draxgd.forumotion.com/f16-spell-lists"><strong>Spell Lists</strong></a><br />Pretty self-explanatory, this is where the player's spell lists are located.<br />   
        </td>
                   
      </tr>
                 
      <tr>
                     
        <td>
              <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />       
        </td>
                     
        <td class="mf-ajax">
                  <a href="http://draxgd.forumotion.com/f22-private-party-occ"><strong>Private Party OCC</strong></a><br />Self-explanatory, this is where parties can discuss among their teammates privately.<br />   
        </td>
                     
        <td>
              <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />       
        </td>
                     
        <td class="mf-ajax">
                  <a href="http://draxgd.forumotion.com/f53-affiliations"><strong>Affiliations</strong></a><br />This is where players can create their own affiliations (guilds, independent organizations, groups, etc). Fill out the <a href="http://draxgd.forumotion.com/t449-affiliation-applications">application</a> and then the DM can approve it.     
        </td>
                   
      </tr>
                 
      <tr>
                     
        <td>
              <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />       
        </td>
                     
        <td class="mf-ajax">
                  <a href="http://draxgd.forumotion.com/f54-character-biographies"><strong>Character Biographies</strong></a><br />Denser information on the characters can be found here. Please only one thread per character, thanks!<br />   
        </td>
                     
        <td>
              <img src="http://i19.servimg.com/u/f19/18/90/00/84/copper10.png" />       
        </td>
                     
        <td class="mf-ajax">
                  <a href="http://draxgd.forumotion.com/f65-dd-history"><strong>D&D History</strong></a><br />   
            <div style="text-align: center;">
                  This is where the historical data of the D&D game is held.   
            </div>
             
            <div style="text-align: center;">
                <br /> 
            </div>
                   
            <div style="text-align: center;">
                  <a href="http://draxgd.forumotion.com/t409-warning-read-first" style="font-size: 18px;">WARNING!!</a><br />   
            </div>
                   
        </td>
                   
      </tr>
             
  </tbody>
</table>

Then go to Modules > JavaScript codes management and create a script with the following settings.

Placement : In the homepage
Code:
$(function() {
  if (!_userdata.session_logged_in) return;

  var newPostIcon = 'http://i19.servimg.com/u/f19/18/90/00/84/gold1011.png',
      newPostSelectors = 'img[src="http://i19.servimg.com/u/f19/18/90/00/84/gold1011.png"], img[src="http://i19.servimg.com/u/f19/18/90/00/84/new_po11.png"], img[src="http://i19.servimg.com/u/f19/18/90/00/84/locked11.png"]',
      cell = $('.mf-ajax'),
      a,
      i = 0,
      j = a.length;

  for (; i < j; i++) {
    a = cell[i].getElementsByTagName('A')[0];
    if (a) {
      checkForum(a.href, cell[i]);
    }
  }

  function checkForum(href, node) {
    $.get(href, function(d) {
      var n = $('.forumline', d).find(newPostSelectors)[0],
          img = $(node).previous().find('img')[0];
         
      if (n && img) {
        img.src = newPostIcon;
      }
    });
  };
});

If you add more cells ( <td> ) in your tables, make sure to add class="mf-ajax" to the one which contains a link to a forum.

I wrote this up quickly, so if there's any problems let me know. Smile
Ange Tuteur
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Adding "New Post" to Multi Forums in One

Post by Guest October 28th 2015, 1:11 am

Sorry, I entered all the coding and had one of my members test to see if the image would change since they made a new post and it didn't work.

EDIT: Also keep in mind I just realized the JavaScript disables the Toolbar. Smile
avatar
Guest
Guest


Back to top Go down

Solved Re: Adding "New Post" to Multi Forums in One

Post by Ange Tuteur October 28th 2015, 9:28 am

Ah, I see I made a small typo. Replace the script with this :
Code:
$(function() {
  if (!_userdata.session_logged_in) return;

  var newPostIcon = 'http://i19.servimg.com/u/f19/18/90/00/84/gold1011.png',
      newPostSelectors = 'img[src="http://i19.servimg.com/u/f19/18/90/00/84/gold1011.png"], img[src="http://i19.servimg.com/u/f19/18/90/00/84/new_po11.png"], img[src="http://i19.servimg.com/u/f19/18/90/00/84/locked11.png"]',
      cell = $('.mf-ajax'),
      a,
      i = 0,
      j = cell.length;

  for (; i < j; i++) {
    a = cell[i].getElementsByTagName('A')[0];
    if (a) {
      checkForum(a.href, cell[i]);
    }
  }

  function checkForum(href, node) {
    $.get(href, function(d) {
      var n = $('.forumline', d).find(newPostSelectors)[0],
          img = $(node).previous().find('img')[0];
         
      if (n && img) {
        img.src = newPostIcon;
      }
    });
  };
});
Ange Tuteur
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Adding "New Post" to Multi Forums in One

Post by Guest October 28th 2015, 10:51 am

Okay, that fixed the "disabling toolbar" problem, but the image not changing still exists.
avatar
Guest
Guest


Back to top Go down

Solved Re: Adding "New Post" to Multi Forums in One

Post by Ange Tuteur October 28th 2015, 11:11 am

I found the problem. I accidentally wrote previous() when it's actually prev(). I haven't used these jQuery methods in awhile. Facepalm

It should work now, so try replacing the script with the one below.
Code:
$(function() {
  if (!_userdata.session_logged_in) return;

  var newPostIcon = 'http://i19.servimg.com/u/f19/18/90/00/84/gold1011.png',
      newPostSelectors = 'img[src="http://i19.servimg.com/u/f19/18/90/00/84/gold1011.png"], img[src="http://i19.servimg.com/u/f19/18/90/00/84/new_po11.png"], img[src="http://i19.servimg.com/u/f19/18/90/00/84/locked11.png"]',
      cell = $('.mf-ajax'),
      a,
      i = 0,
      j = cell.length;

  for (; i < j; i++) {
    a = cell[i].getElementsByTagName('A')[0];
    if (a) {
      checkForum(a.href, cell[i]);
    }
  }

  function checkForum(href, node) {
    $.get(href, function(d) {
      var n = $('.forumline', d).find(newPostSelectors)[0],
          img = $(node).prev().find('img')[0];
         
      if (n && img) {
        img.src = newPostIcon;
      }
    });
  };
});

Also, if you want to change the new post icon that displays, just find and replace the URL in this variable :
Code:
newPostIcon = 'http://i19.servimg.com/u/f19/18/90/00/84/gold1011.png',
Ange Tuteur
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Adding "New Post" to Multi Forums in One

Post by Guest October 28th 2015, 11:17 am

Beautiful! Thank you so much for your work! I'm sure this was tedious. Smile
avatar
Guest
Guest


Back to top Go down

Solved Re: Adding "New Post" to Multi Forums in One

Post by Ange Tuteur October 28th 2015, 11:25 am

You're welcome. Smile

Haha, not at all.. I'm used to debugging errors in scripts. ^^ Compared to some other things, this was a cake walk. Cool

Topic archived

If you have an problems, feel free to open a new topic. Have a good day. Wink
Ange Tuteur
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

Back to top


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