|
[ C ] Last Post Display on Webpage
|
|
Topic Started: Feb 17 2014, 05:31 PM (887 Views)
|
|
Strifefox
|
Feb 17 2014, 05:31 PM
Post #1
|
- Posts:
- 62
- Group:
- Members
- Member
- #383,585
- Joined:
- February 18, 2010
- I'm Browsing With
- Chrome
- My Board URL
- http://w11.zetaboards.com/Dracadia/index/
|
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!
|
|
|
| |
|
DaPizzaMan
|
Feb 17 2014, 06:59 PM
Post #2
|
#TeamSupport
- Posts:
- 5,109
- Group:
- Support Team
- Member
- #386,619
- Joined:
- September 28, 2010
- I'm Browsing With
- Safari · Chrome
- My Board URL
- http://s4.zetaboards.com/zbThemes/index/
|
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?
|
|
|
| |
|
Strifefox
|
Feb 17 2014, 09:47 PM
Post #3
|
- Posts:
- 62
- Group:
- Members
- Member
- #383,585
- Joined:
- February 18, 2010
- I'm Browsing With
- Chrome
- My Board URL
- http://w11.zetaboards.com/Dracadia/index/
|
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.
|
|
|
| |
|
DaPizzaMan
|
Feb 18 2014, 09:47 PM
Post #4
|
#TeamSupport
- Posts:
- 5,109
- Group:
- Support Team
- Member
- #386,619
- Joined:
- September 28, 2010
- I'm Browsing With
- Safari · Chrome
- My Board URL
- http://s4.zetaboards.com/zbThemes/index/
|
- 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).
|
|
|
| |
|
Strifefox
|
Feb 18 2014, 09:57 PM
Post #5
|
- Posts:
- 62
- Group:
- Members
- Member
- #383,585
- Joined:
- February 18, 2010
- I'm Browsing With
- Chrome
- My Board URL
- http://w11.zetaboards.com/Dracadia/index/
|
Thank you! It's perfect, you're the best 
Though I don't know what I'm doing wrong here. It's showing doubles of all listed posts for some reason.
|
|
|
| |
|
DaPizzaMan
|
Feb 18 2014, 10:24 PM
Post #6
|
#TeamSupport
- Posts:
- 5,109
- Group:
- Support Team
- Member
- #386,619
- Joined:
- September 28, 2010
- I'm Browsing With
- Safari · Chrome
- My Board URL
- http://s4.zetaboards.com/zbThemes/index/
|
- Strifefox
- Feb 18 2014, 09:57 PM
Thank you! It's perfect, you're the best  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?
|
|
|
| |
|
Strifefox
|
Feb 18 2014, 10:33 PM
Post #7
|
- Posts:
- 62
- Group:
- Members
- Member
- #383,585
- Joined:
- February 18, 2010
- I'm Browsing With
- Chrome
- My Board URL
- http://w11.zetaboards.com/Dracadia/index/
|
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>
|
|
|
| |
|
DaPizzaMan
|
Feb 19 2014, 10:37 AM
Post #8
|
#TeamSupport
- Posts:
- 5,109
- Group:
- Support Team
- Member
- #386,619
- Joined:
- September 28, 2010
- I'm Browsing With
- Safari · Chrome
- My Board URL
- http://s4.zetaboards.com/zbThemes/index/
|
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 ): - 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>
|
|
|
| |
|
Strifefox
|
Feb 19 2014, 11:19 AM
Post #9
|
- Posts:
- 62
- Group:
- Members
- Member
- #383,585
- Joined:
- February 18, 2010
- I'm Browsing With
- Chrome
- My Board URL
- http://w11.zetaboards.com/Dracadia/index/
|
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.
|
|
|
| |
|
ksh
|
Feb 20 2014, 03:08 PM
Post #10
|
- Posts:
- 108
- Group:
- Members
- Member
- #611,137
- Joined:
- September 11, 2013
|
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.
|
|
|
| |
|
Strifefox
|
Feb 20 2014, 11:19 PM
Post #11
|
- Posts:
- 62
- Group:
- Members
- Member
- #383,585
- Joined:
- February 18, 2010
- I'm Browsing With
- Chrome
- My Board URL
- http://w11.zetaboards.com/Dracadia/index/
|
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 -->
|
|
|
| |
|
ksh
|
Feb 21 2014, 06:23 PM
Post #12
|
- Posts:
- 108
- Group:
- Members
- Member
- #611,137
- Joined:
- September 11, 2013
|
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.
|
|
|
| |
|
Strifefox
|
Feb 21 2014, 10:26 PM
Post #13
|
- Posts:
- 62
- Group:
- Members
- Member
- #383,585
- Joined:
- February 18, 2010
- I'm Browsing With
- Chrome
- My Board URL
- http://w11.zetaboards.com/Dracadia/index/
|
Thank you for the tip Ksh!
|
|
|
| |
|
Liam
|
Mar 2 2014, 08:01 PM
Post #14
|
~
- Posts:
- 4,328
- Group:
- Support Team
- Member
- #174,776
- Joined:
- September 22, 2008
- I'm Browsing With
- Chrome
|
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.
|
|
|
| |
| 1 user reading this topic (1 Guest and 0 Anonymous)
|