Link to home
Start Free TrialLog in
Avatar of driven13
driven13

asked on

Pulling posts and headings to display outside the phpBB Forums

Hello experts:

I have version 3.x installed.

All I am trying to do is pull the top 5 posts (Topic, heading, link to latest post, number of posts) and display them on an EXTERNAL page that is NOT part of the phpBB Forums pages.

I am including this code at the top so that I can communicate with the Forums' database:

define('IN_PHPBB', true);
$phpbb_root_path = './forums/phpBB3/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

Open in new window


But I have no idea what to do to get the 5 posts to show up on the page as described above.

I have found this article that talks about it but as I am an absolute noob in all this, I could not figure it out:

http://blog.phpbb.com/2009/11/09/how-to-display-posts-and-topics-on-external-pages/


Can someone please help???

--d.
Avatar of compfixer101
compfixer101
Flag of United States of America image

define topic, do you mean forum(board)?

are you using this on a php or html page?
Avatar of driven13
driven13

ASKER

Thanx for the response compfixer101.

I meant pull the SUBJECT of the latest 5 Topics that someone has responded to.  This SUBJECT is a link that goes to the latest unread posting for that user.  Right next to the SUBJECT would be the NUMBER OF TOTAL POSTS within parenthesis.

Right below the SUBJECT would be the TOPIC itself and the login name of the LATEST POSTER.  Next to the TOPIC would the DATE and TIME of the latgest post.

For example:

Why is my screen Flickering? (3)
in Computer Support by Techy4Ever, 06-12-10 21:54

"Why is my screen Flickering" is a link that will take the user to the first unread post for that Topic for that user.  If this is too difficult to accomplish, taking him to the last unread post is fine too.

This is a regular  php page of my website  that is outside the Forums.

Users should be able to see these pulled posts ONLY if their user permissons allow it.  So a regular user cannot see the Admin posts being pulled and a Guest cannot see Registered Users or Admin users posts being pulled and so on and so forth.

Thank you so much for your time.

Regards,

--d.

i'll see what i can do, been a while since i did some coding with phpbb,

i'll have to do some testing
Thank you sir.

I really appreciate it.

My ignorance and my age gets in my way sometimes.

--d.
ASKER CERTIFIED SOLUTION
Avatar of compfixer101
compfixer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanx for the link.  I have gotten a start on this and have installed the files for the MOD.

Will you please show me how to display this in my php page that is outside the Forums....???  The Forum tags are showing up as text.  

<div class="forabg">
	<div class="inner"><span class="corners-top"><span></span></span>
		<table class="table1" cellspacing="1" id="top_five">
		<thead>
		<tr>
			<th style="width: 50%;">{L_NEWEST_TOPICS}</th>
			<th style="width: 20%;">{L_TOP_FIVE_ACTIVE}</th>
			<th style="width: 30%;">{L_TOP_FIVE_NEWEST}</th>
		</tr>
		</thead>
		<tbody>
			<tr class="bg2">
					<td valign="top"><!-- BEGIN top_five_topic --><!-- IF top_five_topic.NO_TOPIC_TITLE-->{top_five_topic.NO_TOPIC_TITLE}<!-- ELSE --><a href="{top_five_topic.U_TOPIC}">{top_five_topic.TOPIC_TITLE}</a><br />&nbsp;&nbsp;{top_five_topic.USERNAME_FULL}&nbsp;&nbsp;{top_five_topic.LAST_TOPIC_TIME}<br /><!-- ENDIF --><!-- END top_five_topic --></td>
					<td valign="top"><!-- BEGIN top_five_active -->{top_five_active.USERNAME_FULL}<br />&nbsp;&nbsp;{L_POSTS}: <a href="{top_five_active.S_SEARCH_ACTION}">{top_five_active.POSTS}</a><br /><!-- END top_five_active --></td>
					<td valign="top"><!-- BEGIN top_five_newest -->{top_five_newest.USERNAME_FULL}<br />&nbsp;&nbsp;{L_JOINED}: {top_five_newest.REG_DATE}<br /><!-- END top_five_newest --></td>
				</tr>
		</tbody>
		</table>

	<span class="corners-bottom"><span></span></span></div>
</div>

Open in new window


The code below is what I am using to display information from the Forums on my php page:  The chunk of code shown above needs to show up even if the user has not logged in.

<?php

if($user->data['is_registered'])
{
//User is already logged in
echo "<b>This is the first page.</b><br>";
echo "Welcome back " . $user->data['username'] . ".<br>";
echo "<a href=/secondpage.php>Go to the second page.</a><br>";
echo '<a href=userlogout.php>Log out</a>';
//echo '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout', true, $user->session_id). '">Log out</a>';

}
else
{
?>

Please log in:<br />
<form method="POST" action="./forums/phpBB3/ucp.php?mode=login">
<p>Username: <input type="text" name="username" size="40"><br />
Password: <input type="password" name="password" size="40"><br />
Remember Me?: <input type="checkbox" name="autologin"><br />
<input type="hidden" name="redirect" value="/test.php">
<input type="submit" value="Submit" name="login"></p>
</form>

<?php
}
?>

Open in new window


Thanx in advance,

--d.
Following from above, I have seen others use an INCLUDE file in their regular EXTERNAL php-webpage to accomplish this.

But when I do this:

 INCLUDE ("forums/phpBB3/styles/black_pearl/template/top_five_body.html");

Open in new window


it just outputs the raw code.

I have also tried to put this INCLUDE file outside the php-tags like so:

<!-- INCLUDE forums/phpBB3/styles/black_pearl/template/top_five_body.html -->

Open in new window


but then it does even display the raw code.

Any help with how I can accomplish this?

Thanx again,

--d.
mind giving me some links or the whole code or file to play around with?
all should be php files, and make sure you include the language file.
There is a lot more involved in this than I originally anticipated.

May drop this whole idea.

But thanx for at least pointing me in the right direction with that link you posted.

--d.