Firefox PHP

Latest post (the body text) on other page

Posted by Rene 
Latest post (the body text) on other page
February 13, 2001 09:10PM
Hi

How do I display the latest post to the forum on another page?
I want to display the text, not just the topic.

I hope someone can help me.

Regards

Renˆ
Rene
Re: Latest post (the body text) on other page
February 27, 2001 08:56AM
Well nevermind.. figured it out...

I made apache load index.php instead of index.html and put the script below in there:
The biggest problem was figuring out the "$f=1" part... If you have more than one forum, only post in the first forum will be shown..


<?
$f=1;
chdir("../phorum/");
include "common.php";
$number=5; // number of messages to show.
$SQL="select id, thread, author, subject, datestamp from $ForumTableName order by datestamp desc limit $number";
$q->query($DB, $SQL);
$rec=$q->getrow();
while(is_array($rec)){
echo "<img src=images/box.gif WIDTH=9 HEIGHT=21 BORDER=0 align=absmiddle> $rec[author] -<a href=\"$forum_url/$read_page.$ext?f=$num&i=$rec[id]&t=$rec[thread]\"> $rec[subject] </a>- $rec[datestamp]<br>\n";
$rec=$q->getrow();
}
?>


best regards

Renˆ
Rene
Re: Latest post (the body text) on other page
February 27, 2001 09:00AM
Well never mind.. figured it out...

I made apache load index.php instead of index.html.

Then I modified the quicklist scripts included in phorum already.

The biggest problem was figuring out the "$f=1" part... If you have more than one forum, only post in the first forum will be shown..
Just put "$f=1" (without quotes) before the chdir... part.
Put the script in my index.php and it works.

best regards

Renˆ
Rene
This will show the body text, not the subject
March 12, 2001 09:06PM
Sorry about the previous posts. I got carried away on getting something to work.

This will show the text bodies of the last 5 posts.

Only problem is that the post is displayed without carrige returns. I don't know why and I don't know how to fix it.

Combine it with the scripts in my previous posts to get a subject and author.

------------ php script start ----------
<?
// this will show the last five posts in forum number 1.

$f=1; // the is the forum number, as I only have one forum, I use number one

chdir("../phorum/"); // change this to fit your system
include "common.php";

$number=5; // number of messages to show.

// NOTICE: on the line below you must change the part which says YourForumName
// to fit your needs. the "_bodies" part is the table that hold the text bodies

$SQL="select id, body from YourForumName_bodies order by id desc limit $number";
$q->query($DB, $SQL);
$rec=$q->getrow();
while(is_array($rec)){
echo " $rec[body]<br>\n";
$rec=$q->getrow();
}
?>
------------ php script end ----------
Rene
Re: This will show the body text, not the subject
March 13, 2001 08:57PM
Hi again...

Figured this much out.

You can replace the $SQL= .... line with the one below to make it dependent of the forum name.


$SQL="select id, body from $ForumTableName"."_bodies order by id desc limit $number";
Sorry, you do not have permission to post/reply in this forum.