Adding "New Post" to Multi Forums in One
2 posters
Page 1 of 1
Adding "New Post" to Multi Forums in One
Technical Details
Forum version : #phpBB2Position : 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
Guest- Guest
Re: Adding "New Post" to Multi Forums in One
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
Re: Adding "New Post" to Multi Forums in One
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.
I have tested it too and they didn't change when a new post was posted.
Guest- Guest
Re: Adding "New Post" to Multi Forums in One
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..
Re: Adding "New Post" to Multi Forums in One
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.
Guest- Guest
Re: Adding "New Post" to Multi Forums in One
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.
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.
Re: Adding "New Post" to Multi Forums in One
Of course, thank you!
8 Blocks
6 Blocks
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>
Guest- Guest
Re: Adding "New Post" to Multi Forums in One
Replace the 8 blocks with this :
and the 6 blocks with this :
Then go to Modules > JavaScript codes management and create a script with the following settings.
Placement : In the homepage
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.
- 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.
Re: Adding "New Post" to Multi Forums in One
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.
EDIT: Also keep in mind I just realized the JavaScript disables the Toolbar.
Guest- Guest
Re: Adding "New Post" to Multi Forums in One
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;
}
});
};
});
Re: Adding "New Post" to Multi Forums in One
Okay, that fixed the "disabling toolbar" problem, but the image not changing still exists.
Guest- Guest
Re: Adding "New Post" to Multi Forums in One
I found the problem. I accidentally wrote previous() when it's actually prev(). I haven't used these jQuery methods in awhile.
It should work now, so try replacing the script with the one below.
Also, if you want to change the new post icon that displays, just find and replace the URL in this variable :
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',
Re: Adding "New Post" to Multi Forums in One
Beautiful! Thank you so much for your work! I'm sure this was tedious.
Guest- Guest
Re: Adding "New Post" to Multi Forums in One
You're welcome.
Haha, not at all.. I'm used to debugging errors in scripts. ^^ Compared to some other things, this was a cake walk.
Topic archived
If you have an problems, feel free to open a new topic. Have a good day.
Haha, not at all.. I'm used to debugging errors in scripts. ^^ Compared to some other things, this was a cake walk.
Topic archived
If you have an problems, feel free to open a new topic. Have a good day.
Similar topics
» Problems adding this multi-step form
» Multi Forums In One (problem)
» multi forums in one
» multi forums in one
» Multi forums in one code
» Multi Forums In One (problem)
» multi forums in one
» multi forums in one
» Multi forums in one code
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum