We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Locked Topic
[ C ] Last Post Display on Webpage
Topic Started: Feb 17 2014, 05:31 PM (887 Views)
Strifefox
Member Avatar
Tú Eres Pirata!
[ *  * ]
Board Address: http://w11.zetaboards.com/Dracadia/index/
Board Software: ZetaBoards
Description: Show Last Posts in Forum on Webpage

I would like a way to display the Last Posts, posted a particular forum of my board - but instead of displaying in the Portal, I want it to display on a webpage I made. However, I don't want it to show up in the Portal either. Just the one page that I am making specifically for the posts. More Specifically...I have a Webpage I made on Zetaboards for Affiliates and Advertisements. I have a forum on my site where other sites can post there advertisements. I would like to display, lets say for example, the last 5 advertisements posted by guests, on the webpage - and not showing up in the Portal too.

Not even sure if this can be done. But I am hopeful!
Offline Profile Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

Would you be okay with them posting their advertisements in one topic that would then display on that webpage?

I only ask because it would be sort of strenuous to retrieve all X amount of topics and display their advertisement.

Also, how would the advertisement be displayed? Do you want the whole post displayed on the webpage?
Edited by DaPizzaMan, Feb 17 2014, 07:01 PM.
Offline Profile Goto Top
 
Strifefox
Member Avatar
Tú Eres Pirata!
[ *  * ]
While it would be cool, usually people come start a new thread to post up there advertisements. I was looking for it to just display like the link name/title of thread and the poster name. Kind of like how the data is posted in the Portal for Last Posts Made.

*Edit note: If I did have a single post it mined from. That could work. I would have a special add spot thread where people could just link to there full advertisement thread in the board or something special! I'd be alright with that.
Edited by Strifefox, Feb 17 2014, 09:59 PM.
Offline Profile Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

Strifefox
Feb 17 2014, 09:47 PM
While it would be cool, usually people come start a new thread to post up there advertisements. I was looking for it to just display like the link name/title of thread and the poster name. Kind of like how the data is posted in the Portal for Last Posts Made.

*Edit note: If I did have a single post it mined from. That could work. I would have a special add spot thread where people could just link to there full advertisement thread in the board or something special! I'd be alright with that.
I decided to go with your initial request of individual topics for the advertisements.

Admin CP > Website Maker > (The page you created for advertisements):
Code: HTML
 
<div class="portal_box">
<h2>Latest Advertisements</h2>
<noscript>Please turn on JavaScript to see advertisements.</noscript>
<script type="text/javascript">
var fID = 3857147, // Forum ID of advertisements forum (in the URL – "/forum/[...]")
numPosts = 2, // # of advertisements to display
$this = $('div.site_wrapper'); // DO NOT EDIT



$.get(main_url + 'forum/' + fID + '/1/', function (data) {
$('table.posts tbody tr[class]:not(.pin):lt(' + numPosts + ')', data).each(function () {
var advURL = $(this).find('td.c_cat-title a[href*="/topic/"]').clone().wrap('<span />').parent().html(),
advUser = $(this).find('td.c_cat-starter').html(),
advReplies = $(this).find('td.c_cat-replies a').text();

$('div.portal_box').append('<h4><strong>' + advURL + '</strong></h4><div class="portal_content">' + advUser + '<br>Replies: ' + advReplies + '</div>');
});
});
</script>
</div>
The only things you want to change are the fID and numPosts variables.
  • fID: The forum ID of the forum in which advertisements are posted. To find the ID, look for the value after "/forum/" in the URL.
  • numPosts: The number of advertisements to display on the webpage (try to limit this to a maximum of 10).
Edited by DaPizzaMan, Feb 18 2014, 09:53 PM.
Offline Profile Goto Top
 
Strifefox
Member Avatar
Tú Eres Pirata!
[ *  * ]
Thank you! It's perfect, you're the best :D

Though I don't know what I'm doing wrong here. It's showing doubles of all listed posts for some reason.
Edited by Strifefox, Feb 18 2014, 10:12 PM.
Offline Profile Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

Strifefox
Feb 18 2014, 09:57 PM
Thank you! It's perfect, you're the best :D

Though I don't know what I'm doing wrong here. It's showing doubles of all listed posts for some reason.
May I see what you have on the webpage?
Offline Profile Goto Top
 
Strifefox
Member Avatar
Tú Eres Pirata!
[ *  * ]
http://w11.zetaboards.com/Dracadia/pages/affliate/

Derp you meant the code lol

Code:
 
<div class="category" style="margin: 10px auto">
<table class="cat_head"><tr><td>
<h2>Current Affiliates == <a href="http://w11.zetaboards.com/Dracadia/topic/8583495">Click here to apply for your spot</a></h2>
</td></tr></table><center>
<a href=http://www.dragonsforeveryone.com><img src=http://dragonsforeveryone.catgrins.com/buttonsandbanners/d4eoanimated.gif>

<a href="http://z8.invisionfree.com/evergen"><img src="http://i23.photobucket.com/albums/b383/ArdorCanis/EvergenButton.png">

<a href="http://z7.invisionfree.com/Sekkai_Fractures/index.php?"><img src="http://i185.photobucket.com/albums/x204/ShadowToxin/SFstampV1.jpg"></a>

<a href="http://hourglass-rpg.com"><img src="http://i83.photobucket.com/albums/j314/hallipott8r/a_hourglass/hrglassbt.gif"></a>

<a href="http://istari.b1.jcink.com"><img src="http://i48.tinypic.com/2pt8iuv.gif"></a>

<a href="http://to-rule-the-skies.proboards.com/index.cgi"><img src="http://i48.tinypic.com/2lvgxoi.png"></a>

<a href="http://itsaweyr.proboards.com/index.cgi"><img src="http://i82.photobucket.com/albums/j280/Chaos02/Lapis%20Nix%20Dragons/LNButton_zps987cd069.png"></a>

<a href="http://perfectstorm.b1.jcink.com"><img src="http://i43.tinypic.com/xok2gp.jpg"></a>
</center>
<div class="category" style="margin: 10px auto">
<table class="cat_head"><tr><td>
<h2><a href="http://usa.ultimatetopsites.com/bin/topsite.cgi?WhiteDeath&cat=entertainment&ID=441">
<img src="http://usa.ultimatetopsites.com/bin/votepicture.art?WhiteDeath&cat=entertainment&ID=441" border=0></a> <b>Vote for us on Topsites!</b> <b>And check us out on NexusTree</b> <a href="http://planetnexus.net/" title="Planet Nexus"><img src="http://z3.ifrm.com/269/184/0/p256705/PNaff.png"></a></center></table></center>



<div class="category" style="margin: 10px auto">
<table class="cat_head"><tr><td>
<h2>Latest Advertisements == <a href= "http://w11.zetaboards.com/Dracadia/topic/8736062/1/">Click here to find out how to post one!</a></h2>
</td></tr></table>
<div class="portal_box">
<noscript>Please turn on JavaScript to see advertisements.</noscript>
<script type="text/javascript">
var fID = 3674004, // Forum ID of advertisements forum (in the URL – "/forum/[...]")
numPosts = 5, // # of advertisements to display
$this = $('div.site_wrapper'); // DO NOT EDIT


$.get(main_url + 'forum/' + fID + '/1/', function (data) {
$('table.posts tbody tr[class]:not(.pin):lt(' + numPosts + ')', data).each(function () {
var advURL = $(this).find('td.c_cat-title a[href*="/topic/"]').clone().wrap('<span />').parent().html(),
advUser = $(this).find('td.c_cat-starter').html(),
advReplies = $(this).find('td.c_cat-replies a').text();

$('div.portal_box').append('<h4><strong>' + advURL + '</strong></h4><div class="portal_content">' + advUser + '<br>Replies: ' + advReplies + '</div>');
});
});
</script>
</div>
Edited by Strifefox, Feb 18 2014, 10:34 PM.
Offline Profile Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

It works fine for me. I did fix your HTML as you had some missing closing tags and your syntax was wacky. So replace your webpage code with the following (everything is still there, I promise :P ):
Code: HTML
 
<div class="category" style="margin: 10px auto">
<table class="cat_head">
<tbody>
<tr>
<td>
<h2>Current Affiliates == <a href="http://w11.zetaboards.com/Dracadia/topic/8583495">Click here to apply for your spot</a></h2>
</td>
</tr>
</tbody>
</table>
<table class="forums">
<tbody>
<tr>
<td>
<div style="text-align:center">
<a href=http://www.dragonsforeveryone.com>
<img src=http://dragonsforeveryone.catgrins.com/buttonsandbanners/d4eoanimated.gif>
</a>

<a href="http://z8.invisionfree.com/evergen">
<img src="http://i23.photobucket.com/albums/b383/ArdorCanis/EvergenButton.png">
</a>

<a href="http://z7.invisionfree.com/Sekkai_Fractures/index.php?">
<img src="http://i185.photobucket.com/albums/x204/ShadowToxin/SFstampV1.jpg">
</a>

<a href="http://hourglass-rpg.com">
<img src="http://i83.photobucket.com/albums/j314/hallipott8r/a_hourglass/hrglassbt.gif">
</a>

<a href="http://istari.b1.jcink.com">
<img src="http://i48.tinypic.com/2pt8iuv.gif">
</a>

<a href="http://to-rule-the-skies.proboards.com/index.cgi">
<img src="http://i48.tinypic.com/2lvgxoi.png">
</a>

<a href="http://itsaweyr.proboards.com/index.cgi">
<img src="http://i82.photobucket.com/albums/j280/Chaos02/Lapis%20Nix%20Dragons/LNButton_zps987cd069.png">
</a>

<a href="http://perfectstorm.b1.jcink.com">
<img src="http://i43.tinypic.com/xok2gp.jpg">
</a>
</div>
</td>
</tr>
</tbody>
</table>
</div>

<div class="category" style="margin: 10px auto">
<table class="cat_head">
<tbody>
<tr>
<td>
<h2>
<a href="http://usa.ultimatetopsites.com/bin/topsite.cgi?WhiteDeath&cat=entertainment&ID=441">
<img src="http://usa.ultimatetopsites.com/bin/votepicture.art?WhiteDeath&cat=entertainment&ID=441" border="0"/>
</a>
<strong>Vote for us on Topsites! And check us out on NexusTree</strong>
<a href="http://planetnexus.net/" title="Planet Nexus">
<img src="http://z3.ifrm.com/269/184/0/p256705/PNaff.png"/>
</a>
</h2>
</td>
</tr>
</tbody>
</table>
</div>



<div class="category" style="margin: 10px auto">
<table class="cat_head">
<tbody>
<tr>
<td>
<h2>Latest Advertisements == <a href= "http://w11.zetaboards.com/Dracadia/topic/8736062/1/">Click here to find out how to post one!</a></h2>
</td>
</tr>
</tbody>
</table>
<table class="forums">
<tbody>
<tr>
<td>
<div class="portal_box">
<noscript>Please turn on JavaScript to see advertisements.</noscript>
<script type="text/javascript">
var fID = 3674004, // Forum ID of advertisements forum (in the URL – "/forum/[...]")
numPosts = 5, // # of advertisements to display
$this = $('div.site_wrapper'); // DO NOT EDIT


$.get(main_url + 'forum/' + fID + '/1/', function (data) {
$('table.posts tbody tr[class]:not(.pin):lt(' + numPosts + ')', data).each(function () {
var advURL = $(this).find('td.c_cat-title a[href*="/topic/"]').clone().wrap('<span />').parent().html(),
advUser = $(this).find('td.c_cat-starter').html(),
advReplies = $(this).find('td.c_cat-replies a').text();

$('div.portal_box').append('<h4><strong>' + advURL + '</strong></h4><div class="portal_content">' + advUser + '<br>Replies: ' + advReplies + '</div>');
});
});
</script>
</div>
</td>
</tr>
</tbody>
</table>
</div>
Offline Profile Goto Top
 
Strifefox
Member Avatar
Tú Eres Pirata!
[ *  * ]
Still doing it...

I must have something messed up with code else where on in the template... I'll have to do some code hunting and find it. Thank you so much for the code though! I'll mess around with things until I find where the glitch is hiding.
Offline Profile Goto Top
 
ksh
Member
[ *  * ]
The code looks good to me. $this isn't used so there was no reason to have it defined, but it's not the cause of any issues.

@Strifefox: the ajax call is being ran twice. There are a few causes. The most obvious ones are:
1. You have the same code in there twice; or
2. Some code is making a request to the same page and actually evaluating its source; or
3. You have this code in a board wrapper instead of in the affiliates site.

It's hard to debug without access because there's a lot of things going on in the page. If you would like someone to debug it, you would have to allow him/her access to the AdminCP. That's dangerous on your live site so I suggest you create a test board with the same set up of all your scripts, themes, and the affiliates page. Of course, you may need to update all scripts that require some form of forum or topic ID because those will not map to the same values on the new board.
Offline Profile Goto Top
 
Strifefox
Member Avatar
Tú Eres Pirata!
[ *  * ]
I checked to make sure it wasn't doubled on the web page I entered it into. The code displayed above in the box is verbatim from the actual page. I never entered it anywhere else on the site (in any of my themes css or anywhere in the board template.) Only that page. Thank you for the advice! If I can find someone to debug that isn't someone I trust completely, I'll be sure to upload all things to a test board and let them look at it first :)

I can try removing other features on the site until it stops doubling like that too.

Edit: Found the offending code. I went through and removed each code individually and put them back until i found the one code that made it view right. It's a code that allows posts to have a topic icon.

Code:
 
<!-- START TOPIC ICON CODE -->
<script type="text/javascript">
var topicicon = new Array(); t=0;
topicicon[t++] = new Array("M","http://i270.photobucket.com/albums/jj96/strifefox/Dracadia/Maleic.png");
topicicon[t++] = new Array("F","http://i270.photobucket.com/albums/jj96/strifefox/Dracadia/Femaleic.png");
topicicon[t++] = new Array("1","http://i270.photobucket.com/albums/jj96/strifefox/Dracadia/Dragonico.png");
topicicon[t++] = new Array("2","http://i270.photobucket.com/albums/jj96/strifefox/Dracadia/Wyvernic.png");
topicicon[t++] = new Array("3","http://i270.photobucket.com/albums/jj96/strifefox/Dracadia/Lizardlingico.png");
topicicon[t++] = new Array("4","http://i270.photobucket.com/albums/jj96/strifefox/Dracadia/Gryphonpic.png");
topicicon[t++] = new Array("5","http://i270.photobucket.com/albums/jj96/strifefox/Dracadia/birthday.png");
topicicon[t++] = new Array("6","http://i270.photobucket.com/albums/jj96/strifefox/Dracadia/hatching.png");
topicicon[t++] = new Array("7","http://i270.photobucket.com/albums/jj96/strifefox/Dracadia/yeild.png");
topicicon[t++] = new Array("8","http://i270.photobucket.com/albums/jj96/strifefox/Dracadia/here.png");
topicicon[t++] = new Array("9","http://i270.photobucket.com/albums/jj96/strifefox/Dracadia/luff.png");
topicicon[t++] = new Array("10","http://i270.photobucket.com/albums/jj96/strifefox/Dracadia/party.png");
topicicon[t++] = new Array("11","http://i270.photobucket.com/albums/jj96/strifefox/Dracadia/poll.png");
topicicon[t++] = new Array("12","http://i270.photobucket.com/albums/jj96/strifefox/Dracadia/wip.png");
topicicon[t++] = new Array("13","http://i270.photobucket.com/albums/jj96/strifefox/Dracadia/no.png");
</script>
<script type='text/javascript' src='http://z4.ifrm.com/30095/43/0/p1097072/TopicIcons.js'></script>
<!-- END TOPIC ICON CODE -->
Edited by Strifefox, Feb 20 2014, 11:26 PM.
Offline Profile Goto Top
 
ksh
Member
[ *  * ]
Ouch... that code is a bit dangerous to use. Quozzo's code re-runs all HTML in those selectors, so any scripts in them will be re-ran :(. Ideally, the code should be modified to be very specific in the selectors to add topic icons to. This falls under #2 in the list of items in my previous post.

A hack / temporary fix can be to wrap it in a check to see if the html source contains a [ ti ] (no spaces) before attempting to replace. But that is definitely not a permanent or a true fix and any content in the selectors with the "[ ti ]" (no spaces) string will result in this same bug.
Offline Profile Goto Top
 
Strifefox
Member Avatar
Tú Eres Pirata!
[ *  * ]
Thank you for the tip Ksh!
Offline Profile Goto Top
 
Liam
Member Avatar
~

Completed!

Your request has been completed. If you have any questions or concerns regarding the state of your request, please feel free to contact me via PM.
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Closed Requests · Next Topic »
Locked Topic