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
  • 9
Latest Posts on external website
Topic Started: Mar 8 2010, 01:21 PM (13,985 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:
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
To get rid of the topic listings from the deposit forums would require a.) JavaScript to remove them after the data has loaded, or b.) Skyon Archer to modify his script to not include listings from the deposit forums.

Option A would reduce the amount of listings shown.

With HTML/CSS knowlege, you can style the listings the way you like since it has a container around the information with an ID.
Offline Profile Quote Post Goto Top
 
Chelonian
Member
[ *  *  * ]
Cory
Oct 30 2016, 09:41 AM
To get rid of the topic listings from the deposit forums would require a.) JavaScript to remove them after the data has loaded, or b.) Skyon Archer to modify his script to not include listings from the deposit forums.

Option A would reduce the amount of listings shown.

With HTML/CSS knowlege, you can style the listings the way you like since it has a container around the information with an ID.
I have extremely limited html and css knowledge.
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
How do you want it to look?
Offline Profile Quote Post Goto Top
 
Chelonian
Member
[ *  *  * ]
Cory
Oct 30 2016, 10:35 PM
How do you want it to look?
Like your active topics code does. Tabled and neat.
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Do you just want it to incorporate the styles of my code, or be similarly organized to my code as well?
Offline Profile Quote Post Goto Top
 
Chelonian
Member
[ *  *  * ]
Cory
Nov 1 2016, 12:00 PM
Do you just want it to incorporate the styles of my code, or be similarly organized to my code as well?
Not quite sure what you mean.

Also, how do I remove your active topics above board from external pages and the portal? I would ask in the original topic the code is in but it's locked.
Edited by Chelonian, Nov 23 2016, 08:47 PM.
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
What don't you understand exactly?

For that code, try this:
Code:
 
<script type="text/javascript">
//<![CDATA[
$(function() {
if (location.href.indexOf('/site/') === -1 || location.href.indexOf('/pages/') === -1) {
var amount = '5';
var fIDS = ['5015162', '5015163', '5016167', '5002983'];
$.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('#trending_topics');
}
});
});
}
});
//]]>
</script>
Offline Profile Quote Post Goto Top
 
Chelonian
Member
[ *  *  * ]
Re-reading it I get it now. Both style and organisation.
Cory
Nov 24 2016, 04:12 AM
What don't you understand exactly?

For that code, try this:
Code:
 
<script type="text/javascript">
//<![CDATA[
$(function() {
if (location.href.indexOf('/site/') === -1 || location.href.indexOf('/pages/') === -1) {
var amount = '5';
var fIDS = ['5015162', '5015163', '5016167', '5002983'];
$.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('#trending_topics');
}
});
});
}
});
//]]>
</script>
Where does this code go?
Edited by Chelonian, Nov 25 2016, 06:48 PM.
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Try this below the code:
Code:
 
<script type="text/javascript">
//<![CDATA[
$('#latest small').before('<table style="margin-bottom: 10px"></table>');
$('#latest h4, #latest div.portal_content').hide();

$('#latest h4').each(function() {
var title = $(this).find('a').text();
var href = $(this).find('a').attr('href');
var uTitle = $(this).next('div.portal_content').find('a').text();
var uHref = $(this).next('div.portal_content').find('a').attr('href');
var replies = $(this).next('div.portal_content').text().split('Replies: ')[1];
$(this).parents('#latest').find('table').append('<tr><td><a href="' + href + '">' + title + '</a></td><td class="c"><a href="' + uHref + '">' + uTitle + '</a></td><td class="c">' + replies + '</td></tr>');
});
//]]>
</script>
The script above is to replace this code:
Code:
 
<script type="text/javascript">
//<![CDATA[
$(function() {
var amount = '5';
var fIDS = ['5015162', '5015163', '5016167', '5002983'];
$.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('#trending_topics');
}
});
});
});
//]]>
</script>
Offline Profile Quote Post Goto Top
 
Chelonian
Member
[ *  *  * ]
The remove from external pages and portal code doesn't seem to work.

Neither does the styling code for the updated topics page. I tried putting it on the page in question - no change. And tried underneath the code you said too; still no change.
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Try these instead:
Code:
 
<script type="text/javascript">
//<![CDATA[
$(window).load(function() {
$('#latest small').before('<table style="margin-bottom: 10px"></table>');
$('#latest h4, #latest div.portal_content').hide();

$('#latest h4').each(function() {
var title = $(this).find('a').text();
var href = $(this).find('a').attr('href');
var uTitle = $(this).next('div.portal_content').find('a').text();
var uHref = $(this).next('div.portal_content').find('a').attr('href');
var replies = $(this).next('div.portal_content').text().split('Replies: ')[1];
$(this).parents('#latest').find('table').append('<tr><td><a href="' + href + '">' + title + '</a></td><td class="c"><a href="' + uHref + '">' + uTitle + '</a></td><td class="c">' + replies + '</td></tr>');
});
});
//]]>
</script>
Code:
 
<script type="text/javascript">
//<![CDATA[
$(function() {
if (location.href.indexOf('/site/') !== -1 || location.href.indexOf('/pages/') !== -1) {
$('#trending_topics').hide();
} else {
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('#trending_topics');
}
});
});
}
});
//]]>
</script>
Offline Profile Quote Post Goto Top
 
Chelonian
Member
[ *  *  * ]
Cory
Nov 27 2016, 04:27 AM
Try these instead:
Code:
 
<script type="text/javascript">
//<![CDATA[
$(window).load(function() {
$('#latest small').before('<table style="margin-bottom: 10px"></table>');
$('#latest h4, #latest div.portal_content').hide();

$('#latest h4').each(function() {
var title = $(this).find('a').text();
var href = $(this).find('a').attr('href');
var uTitle = $(this).next('div.portal_content').find('a').text();
var uHref = $(this).next('div.portal_content').find('a').attr('href');
var replies = $(this).next('div.portal_content').text().split('Replies: ')[1];
$(this).parents('#latest').find('table').append('<tr><td><a href="' + href + '">' + title + '</a></td><td class="c"><a href="' + uHref + '">' + uTitle + '</a></td><td class="c">' + replies + '</td></tr>');
});
});
//]]>
</script>
Code:
 
<script type="text/javascript">
//<![CDATA[
$(function() {
if (location.href.indexOf('/site/') !== -1 || location.href.indexOf('/pages/') !== -1) {
$('#trending_topics').hide();
} else {
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('#trending_topics');
}
});
});
}
});
//]]>
</script>
The styling is working fine now but I don't know where to put the hide code.
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Right below the 'style' code will be fine.
Offline Profile Quote Post Goto Top
 
Chelonian
Member
[ *  *  * ]
I'm still having forums posts show that shouldn't - http://s15.zetaboards.com/Discussion_Time/pages/updated/ i.e. online today should be hidden.

Also getting duplication of topic in 'recent topics': http://s15.zetaboards.com/Discussion_Time/index/
Edited by Chelonian, Jan 28 2017, 03:51 PM.
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
In regards to this code, I can certainly hide topics from the listings based on the topic title, but I can't base it on forum ID/name since that information is not present.

Feel free to PM me for support with the 'recent topics' code, since that was made for a code request.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · ZetaBoards Codes & Modifications · Next Topic »
Add Reply
  • Pages:
  • 1
  • 9