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
Latest Posts on external website
Topic Started: Mar 8 2010, 01:21 PM (13,990 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:
paradise.engineering
Member Avatar
Lowpoly Workshop Founder
[ *  *  * ]
no, it was a temp issue, only lasted 24 hours
Offline Profile Quote Post Goto Top
 
manga_service
Member
[ * ]
can you make it so we can see topic views as well ?
Offline Profile Quote Post Goto Top
 
MvS
Extreme Forum Lurker! :P
[ * ]
For some reason, this code is no longer working for me... I now get error messages. Does anyone know what went wrong?

Warning: file_get_contents() [function.file-get-contents]: couldn't resolve host name in <path to index> on line 22

Warning: file_get_contents(http://s4.zetaboards.com/mariovsonic/site/) [function.file-get-contents]: failed to open stream: operation failed in <path to index> on line 22

Here's the modified code:
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 id="portal_news">';
$end_text = '</div></div><div id="portal_clear"> </div>';

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

$source = file_get_contents('http://s4.zetaboards.com/mariovsonic/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_news">

';
echo $found_text;
echo'</div></div>';
clearstatcache();?>

And here is the aforementioned line 22:
Code:
 
$source = file_get_contents('http://s4.zetaboards.com/mariovsonic/site/');

I've tried editing the url, but nothing appears to work. Thanks for any assistance!
Offline Profile Quote Post Goto Top
 
Skyon Archer
Member Avatar
Member
[ *  *  *  * ]
Are you still having an issue? It's working for me by using both your Zetaboards URL and your .co.cc URL
Offline Profile Quote Post Goto Top
 
shezse-ZNR
Member Avatar
Designer
[ * ]
I use this code a while ago.. and It is working.. but I have 1 problem on this.. to confirm the problem.. I read all the comments/posts here in this thread and I found one. As paradise.engineering said,
Quote:
 
if i have a forum that can't be read by guests, only by members.
the posts in that forum will not appear in the Latest div.
the only posts that appear in the Latest div are those in forums readable by guests


This is also my problem.. I don't see the solution about this problem.. I do ACTIVATE the Portal and set the post view to 20. and It is work but only the thread that viewable by guests.. but anyway, it is really great code..


Do you have script that can view all the topics? what I mean is, topics that can be viewed by members, moderators and admin can also appear in the DIV but with PERMISSION settings, topic that cannot read by guests are not be appeared.. topic that cannot read by guests but read by members can appear in the DIV so on so forth.. [although I experience it in one of the forum, they using it INVISIONFREE, I hope ZETA also have it]


*waiting for response.
Offline Profile Quote Post Goto Top
 
Adstarr
Member
[ * ]
Hey, this script sounds awesome, only I can't get it working.

When I enter my portal URL into the website instead of showing the last 5 posts, its just says:

var latestpost = ('
');

Any idea what I'm doing wrong? Thanks in advance.
Offline Profile Quote Post Goto Top
 
Skyon Archer
Member Avatar
Member
[ *  *  *  * ]
Did you follow the steps mentioned in this post?
Offline Profile Quote Post Goto Top
 
Adstarr
Member
[ * ]
Yeah, nothing shows up on my site though. When I clicked someone's url from another page it had there last five posts but mine just said what I posted before and I assumed that was the error?
Offline Profile Quote Post Goto Top
 
shezse-ZNR
Member Avatar
Designer
[ * ]
Codes is still working but is there any way to view the private thread? what I mean is, when viewing as a guests, only public thread can appear in the sidebar.. and when you login as a member or staffs, you can see all the thread posts appear in the sidebar... is there any way for that code??????
Offline Profile Quote Post Goto Top
 
Skyon Archer
Member Avatar
Member
[ *  *  *  * ]
Adstarr - please provide me a link to where you are using this code so I can identify why it's not displaying.

shezse - That should automatically happen. If you can see that new posts have been made, even in a staff only area, then they will be displayed. You have to have the proper permission to see what's new. That's why guests can't see all the posts that have been made, as in staff only areas and such.
Offline Profile Quote Post Goto Top
 
tobeme
Member Avatar
Member
[ *  * ]
Can I rename the "portal" as "latest posts"? Thanks

EDIT: please ignore this. I found the place where to change the name.
Edited by tobeme, Aug 5 2012, 07:59 AM.
Offline Profile Quote Post Goto Top
 
phio_chan
Member Avatar
Wandering, Wondering
[ *  * ]
Hello! Thanks for the code, I think this is what I want to use although I still can't get it working. :P

I want to add latest post information on my forum without enabling the portal. Is it possible? Or should I enable the portal? Because even with the portal active, the codes won't work.

Thanks to whoever helps! :D

edit: Never mind, got it working now. ;)
Edited by phio_chan, Sep 4 2012, 04:56 AM.
Offline Profile Quote Post Goto Top
 
Skyon Archer
Member Avatar
Member
[ *  *  *  * ]
Glad this is working out for everyone :)
Offline Profile Quote Post Goto Top
 
manga_service
Member
[ * ]
has this code stopped working ?
i think mine isnt working anymore
Offline Profile Quote Post Goto Top
 
paradise.engineering
Member Avatar
Lowpoly Workshop Founder
[ *  *  * ]
only on some boards - w11; i have it running on a s4 tho ...
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