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:
Add Reply
  • Pages:
  • 1
  • 10
Latest Posts on external website
Topic Started: Mar 8 2010, 01:21 PM (13,983 Views)
Skyon Archer
Member Avatar
Member
[ *  *  *  * ]
This is an unofficial code I created to pull the Latest Posts from a Zetaboard forum and have them displayed on an external website.

Requirement: Your external website must have and run php

What's this do? The script goes to your Zetaboard portal and looks at the Latest Posts section. It scrapes all the information that is there and then outputs it at the end of the code. You can use a simple php include to place this where you want it to be displayed.

**** in the code is the URL to your Zetaboard forum portal - you must change this to your portal address! ****
Code:
 

<?php
// Latest Posts from a Zetaboard Forum to your website
// Created by Codes Rock, March 2010
// Brag about me to all your friend :)

$start_text = '<div class="portal_box">
<h2>Latest Posts</h2>';
$end_text = '</div></div><div id="portal_r">';


/*********** this is your forums url to the portal ***********************/
/********** you must change this to your portal URL **********************/

$source = file_get_contents('http://s_.zetaboards.com/______/site/');
/***************************************************************************/

$start_pos = strpos($source, $start_text) + strlen($start_text);
$end_pos = strpos($source, $end_text) - $start_pos;

$found_text = substr($source, $start_pos, $end_pos);

echo'<div class="portal_box">
<h2>Latest Posts</h2>';
echo $found_text;
echo'</div></div>';
clearstatcache();
?>


EDIT: I removed the example page (sorry)

It's simple to use and really cool to boot!

VIEW THIS POST IF YOU DON"T HAVE ACCESS TO A SERVER WITH PHP: http://support.zathyus.com/single/?p=18109239&t=5082198
Edited by Skyon Archer, Jan 17 2016, 11:25 PM.
Offline Profile Quote Post Goto Top
 
Replies:
Chelonian
Member
[ *  *  * ]
I can give you the forum ids.

"var fIDS = ['5015162', '5015163', '5016167', '5002983'];"

are them.
Edited by Chelonian, Jan 30 2017, 01:47 PM.
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
I can't remove topics from the listings based on forum ID's since the code does not deposit forum ID's in the listings.
Offline Profile Quote Post Goto Top
 
Chelonian
Member
[ *  *  * ]
Cory
Jan 31 2017, 01:18 PM
I can't remove topics from the listings based on forum ID's since the code does not deposit forum ID's in the listings.
But you can hide topics from forums surely? Like you have done with the 'recent topics' on the main page?
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Not with this code. This code is different. I can only hide topic listings based on the topic title.
Offline Profile Quote Post Goto Top
 
Chelonian
Member
[ *  *  * ]
Damn. I'm sure it was hiding them before all the changes. Could there be another way to have latest posts without the topics from set forums showing? Or...perhaps just use the code for your 'trending topics' and put it on a seperate page as I know that hides them.

Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
You'll have to grab the listings from the active topics page like my code does because the active topics page contains the forum information, the portal page does not.
Offline Profile Quote Post Goto Top
 
Chelonian
Member
[ *  *  * ]
How would I do this? Simply repost your code on a external page?
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Use this for the webpage content:
Code:
 
<table id="latest">
<thead>
<tr>
<th colspan="7">Recent Topics</th>
</tr>
</thead>
<tbody>
</tbody>
</table>

<script type="text/javascript">
//<![CDATA[
$(function() {
var amount = '5';
var fIDS = ['5015162', '5015163', '5016167', '5002983', '5023362'];
$.get(main_url + 'search/?c=5&force_ads', function(data) {
$('tr[class*="row"]:lt(' + amount + ')', data).each(function() {
if ($.inArray($(this).find('a[href*="/forum/"]').attr('href').split('/forum/')[1].split('/')[0], fIDS) === -1) {
var html = '<tr>' + $(this).html() + '</tr>';
$(html).appendTo('#latest tbody');
}
});
});
});
//]]>
</script>
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · ZetaBoards Codes & Modifications · Next Topic »
Add Reply
  • Pages:
  • 1
  • 10