Show single post on another page?

Discussion of general topics related to the new version and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Forum rules
Discussion of general topics related to the new release and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Locked
Frug
Registered User
Posts: 57
Joined: Thu Jul 02, 2009 3:33 am

Show single post on another page?

Post by Frug »

Hey. So I've seen mods that allow me to display a particular post anywhere on a website but I need something simpler and want to do it myself.

What I'd like to know is if there's some documentation (or maybe someone can help) on how to grab the contents of a particular post. Actually I'd like to have a post, specified by a custom user profile field, displayed right in the user's profile.

Surely it's possible and not overly difficult and i'm vaguely familiar already with some of the API but short of sifting through viewtopic.php until I figure out how it's grabbing content, can anyone point me in the right place?
TerryE
Registered User
Posts: 95
Joined: Sat May 23, 2009 12:24 am
Contact:

Re: Show single post on another page?

Post by TerryE »

There is a kB article on how to write a webpage that hooks into the phpBB architecture. This is useful background reading, but apart from that sifting through viewtopic.php and how it uses the various include topics is precisely how you need to proceed. It's only 1600 lines of code.

You may also need to drill down into the various include/function... files as as well as styles/prosilver/template/viewtopic_body.html. This is preprocessed into pretty unreadable (because its not really meant to be read) PHP with a corresponding name in the cache directory. This renders the page. In this HTML the loop that renders the post starts with <!-- BEGIN postrow -->. So postrow.MESSAGE contains the message HTML; postrow.POST_AUTHOR_FULL is the author HTML and postrow.U_POST_AUTHOR the author name, etc.

In viewtopic.php, the posts are fetched in the line $result = $db->sql_query_limit($sql, $sql_limit, $sql_start) and then the result sets stored in the array $post_list. Now look for where $message is retrieved in the line $message = censor_text($row['post_text']) and groomed by bbcode conversion etc. before being stored in the nth post row in the array assignment $postrow = array( ....

Hope that this helps point you in the right direction :)
Frug
Registered User
Posts: 57
Joined: Thu Jul 02, 2009 3:33 am

Re: Show single post on another page?

Post by Frug »

"Only 1600" /o\

I've read about how to make a page that hooks into the architecture and stuff. That took very little time. Authenticating using auth and stuff I can already do, though I don't need it. I guess I was hoping there would be an equivalent api method for grabbing posts (I'm surprised there isn't) as there is for grabbing user data. Maybe there should be? I mean after all it's what the forums do.

You have pointed me the right way though. I'll take a look and ask again if I get stuck. Thanks.
TerryE
Registered User
Posts: 95
Joined: Sat May 23, 2009 12:24 am
Contact:

Re: Show single post on another page?

Post by TerryE »

Frug wrote:"Only 1600" /o\
Yes, only 1600. If you find this bad then I suggest that you avoid FLOSS projects as reading the source is usually the only advanced documentation :lol: I did some tweaks to the Visual Basic subsystem and RTS in OOo and this subsystem was about 100K lines.
Frug wrote:I guess I was hoping there would be an equivalent api method for grabbing posts (I'm surprised there isn't) as there is for grabbing user data.
No there isn't. Why not write an XML "getpost" function, and you can then call it and parse the answer using DOM. You could even post it back here. I mean after all it's what FLOSS packages are all about :)

But on a governance note, this forum really isn't about getting development help for individual implementations, but more rather about development issue that might ultimately enhance the product. You need to try the main support forum for specific help.
lbvagrant
Registered User
Posts: 2
Joined: Mon Aug 17, 2009 6:47 am

Re: Show single post on another page?

Post by lbvagrant »

dont know if you can help but im looking for code that will alow me to
take last few posts under a topic, and make them show on an external web page

like youtube has a video and under it has people talking about it...

i figure show a few posts and if people want to jump in the conversation they just click the link to take them to the board and the reply button and all

i can read code but not write it :(

thnx in advance...
TerryE
Registered User
Posts: 95
Joined: Sat May 23, 2009 12:24 am
Contact:

Re: Show single post on another page?

Post by TerryE »

lbvagrant wrote:i can read code but not write it :(
These forums are for developers who want to discuss "general topics related to the new release and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!" Sorry.
lbvagrant
Registered User
Posts: 2
Joined: Mon Aug 17, 2009 6:47 am

Re: Show single post on another page?

Post by lbvagrant »

i apologize...

then where do we ask for such help? :?:
ToonArmy
Registered User
Posts: 335
Joined: Fri Mar 26, 2004 7:31 pm
Location: Bristol, UK
Contact:

Re: Show single post on another page?

Post by ToonArmy »

On phpBB.com like you have done already. ;)
Chris SmithBlogXMOOhlohArea51WikiNo support via PM/IM
Image
Locked