Display Last 5 Phorum Posts -script
Posted by dagon
Re: Display Last 5 Phorum Posts -script April 12, 2005 11:01AM |
Registered: 17 years ago Posts: 27 |
Panu Wrote:
-------------------------------------------------------
> well I think you want löastest topics instead of
> latest posts so:
>
> it's not perfect either
>
> -=[ Panu ]=-
yes that is what I want... Still looking for the code. If anyone has an idea, please post it.
For now I still searching for the code....
-------------------------------------------------------
> well I think you want löastest topics instead of
> latest posts so:
>
> it's not perfect either
>
> -=[ Panu ]=-
yes that is what I want... Still looking for the code. If anyone has an idea, please post it.
For now I still searching for the code....
Re: Display Last 5 Phorum Posts -script April 13, 2005 04:34AM |
Registered: 20 years ago Posts: 1,076 |
rolo Wrote:
-------------------------------------------------------
> For now I still searching for the code....
Are you really searching or are you asking that someone else should do the searching for you? Or write the code for you? Have yoy tried to search at all? I'm sorry to be so direct, but it is much easier to give answers if a direct question is asked.
I already gave you a link to a thread where all your questions are answered, there's a link to a script that does what you want almost, so what do you need exactly? What is missing from the already existing scripts?
---
-=[ Panu ]=-
-------------------------------------------------------
> For now I still searching for the code....
Are you really searching or are you asking that someone else should do the searching for you? Or write the code for you? Have yoy tried to search at all? I'm sorry to be so direct, but it is much easier to give answers if a direct question is asked.
I already gave you a link to a thread where all your questions are answered, there's a link to a script that does what you want almost, so what do you need exactly? What is missing from the already existing scripts?
---
-=[ Panu ]=-
Re: Display Last 5 Phorum Posts -script April 13, 2005 06:29AM |
Registered: 17 years ago Posts: 27 |
Panu Wrote:
-------------------------------------------------------
> rolo Wrote:
> --------------------------------------------------
> -----
> > For now I still searching for the code....
>
> Are you really searching or are you asking that
> someone else should do the searching for you? Or
> write the code for you? Have yoy tried to search
> at all? I'm sorry to be so direct, but it is much
> easier to give answers if a direct question is
> asked.
>
> I already gave you a link to a thread where all
> your questions are answered, there's a link to a
> script that does what you want almost, so what do
> you need exactly? What is missing from the already
> existing scripts?
>
>
> -=[ Panu ]=-
I've searched the forum. The thread you've given me is the right one I think, they foward the anwser to an other thread, but it's all french. I've already send a PM to the autor of the code to translate the messages in english, but for now I've got no respons.
All I could find is the code (and some others) that I'm using now, those codes shows all posts and threads. I only want the posts. No I'm going to work for school, but in the evening I'm going to work on it again. I think it's quiet simple, because it's only the SQL code which I have to ajust.
//EDIT
I've installed the code from the thread you gave me. But it is exactly the same as all the codes I've found untill now. In the evening I'm going to look closer to it.
Edited 1 time(s). Last edit at 04/13/2005 06:53AM by rolo.
-------------------------------------------------------
> rolo Wrote:
> --------------------------------------------------
> -----
> > For now I still searching for the code....
>
> Are you really searching or are you asking that
> someone else should do the searching for you? Or
> write the code for you? Have yoy tried to search
> at all? I'm sorry to be so direct, but it is much
> easier to give answers if a direct question is
> asked.
>
> I already gave you a link to a thread where all
> your questions are answered, there's a link to a
> script that does what you want almost, so what do
> you need exactly? What is missing from the already
> existing scripts?
>
>
> -=[ Panu ]=-
I've searched the forum. The thread you've given me is the right one I think, they foward the anwser to an other thread, but it's all french. I've already send a PM to the autor of the code to translate the messages in english, but for now I've got no respons.
All I could find is the code (and some others) that I'm using now, those codes shows all posts and threads. I only want the posts. No I'm going to work for school, but in the evening I'm going to work on it again. I think it's quiet simple, because it's only the SQL code which I have to ajust.
//EDIT
I've installed the code from the thread you gave me. But it is exactly the same as all the codes I've found untill now. In the evening I'm going to look closer to it.
Edited 1 time(s). Last edit at 04/13/2005 06:53AM by rolo.
Re: Display Last 5 Phorum Posts -script July 26, 2005 07:59AM |
Registered: 17 years ago Posts: 9 |
September 15, 2005 04:25PM |
Registered: 18 years ago Posts: 666 |
I was having trouble with the include common.php thing, so I took out that, the header, and the footer. The script below works except for one thing--the date. I'm guessing because the thing in the code says $PHORUM before [short_date]. Anyone know how I can change the date statements so they'll actually show?
-------------------------------------------
"Everything we see or seem, is but a dream within a dream." -Edgar Allan Poe
Quote
<?php
$number = 5; // number of messages to show
$count = 20; //words per message to show
$date_format = $PHORUM[short_date]; //changes to short_date if preferred
@$con=mysql_connect("localhost","username","password") or die ("cannot connect to MySQL");
$select_db = mysql_select_db("database",$con);
$result = mysql_query("select * from phorum_messages m, phorum_forums f where m.forum_id = f.forum_id order by m.datestamp desc limit $number") or die("Failed Query of " . $result. mysql_error());
while($row = mysql_fetch_array($result)) {
unset($ellipsis); //remove this line to if your not using the ellipsis
if ($PHORUM[mods][bbcode] ==1) {
$row[body] = preg_replace( "|</*[a-z][^>]*>|i", "", $row[body]);
$row[body] = preg_replace( "|[/*[a-z][^\]]*\]|i", "", $row[body]);
}
$words = split('[ ]+', $row[body]);
if (sizeof($words) > $count) {
$words = array_slice($words, 0, $count);
$ellipsis = " ...";
}
$row[body] = implode($words, ' ');
$row[body]=trim($row[body]);
$row[body]=nl2br($row[body]);
$row[body]=str_replace("<br />"," ",$row[body]);
$row[body]=str_replace("<br>"," ",$row[body]);
$row[body]=str_replace("<p>"," ",$row[body]);
$row[body]=str_replace("</p>"," ",$row[body]);
$row[body] .= $ellipsis; //remove this line to if your not using the ellipsis
$row[datestamp] = strftime($PHORUM["short_date"], $row["datestamp"]);
echo " <tr>";
echo " <td><a href=\"boards/read.php?".$row[forum_id].",".$row[thread].",".$row[message_id]."#".$row[message_id]."\">".$row[subject]."</a></b> by ".$row[author]." ".$row[datestamp]."</td>";
echo " </tr>";
echo " <tr>";
echo " <td>". $row[body]. "</td>";
echo " </tr>";
}
?>
-------------------------------------------
"Everything we see or seem, is but a dream within a dream." -Edgar Allan Poe
September 15, 2005 07:36PM |
Admin Registered: 17 years ago Posts: 8,532 |
Open your language file include/lang/<language>.php. In that file you can find the definition for $PHORUM["short_date"]. The default from the english.php file is:
"%D %I:%M%p"So change the line with $PHORUM["short_date"] to
$row[datestamp] = strftime("%D %I:%M%p", $row["datestamp"]);The code you are using here isn't very clean. There is a define for $date_format for example which is not used. The part that strips bbcode tags from the body won't work, because $PHORUM[mods][bbcode] is not available. If you use bbcode, then you can change
if ($PHORUM[mods][bbcode] ==1) {to
if (1) {Maybe there are more issues, but by making these changes, you should get a step further.
Re: Display Last 5 Phorum Posts -script March 04, 2006 02:30PM |
Registered: 16 years ago Posts: 9 |
Thanks for this, I've got a cut down version appearing on every page (pointing back to a specific forum's posts) and it's great.
Discuss Transit's SH20 Extension - Waterview
Discuss Transit's SH20 Extension - Waterview
Re: Display Last 5 Phorum Posts -script August 23, 2006 08:16AM |
Registered: 15 years ago Posts: 3 |
Hello!
I am using sts's latest post snippet. But I get an error message when I include it in my website. It says:
I did a google-search on that but I still couldnt fix it with the solutions I found.
The latest posts are displayed correctly.
I have the following structure in my website.
root/header.php (all the basic html stuff)
root/index.php (website content, header and footer are included)
root/footer.php (html-tags and php-includes)
The lastposts.php is located at "root/phorum/" and included in root/footer.php.
Thank you for your help!
Edited 1 time(s). Last edit at 08/23/2006 08:18AM by ordinary88.
I am using sts's latest post snippet. But I get an error message when I include it in my website. It says:
Warning: Cannot modify header information - headers already sent by (output started at /home/www/web/html/header.php:4) in /home/www/web/html/phorum/include/users.php on line 180
I did a google-search on that but I still couldnt fix it with the solutions I found.
The latest posts are displayed correctly.
I have the following structure in my website.
root/header.php (all the basic html stuff)
root/index.php (website content, header and footer are included)
root/footer.php (html-tags and php-includes)
The lastposts.php is located at "root/phorum/" and included in root/footer.php.
Thank you for your help!
Edited 1 time(s). Last edit at 08/23/2006 08:18AM by ordinary88.
August 23, 2006 08:28AM |
Admin Registered: 17 years ago Posts: 8,532 |
Phorum tries to set a cookie there, but this is not possible since your header script already sent some data to the browser. Cookies can only be set before that. I'm not sure why the piece of code that you are using now wants to set an authentication cookie (I didn't look at the code), but you can probably fix this by adding the following code to the very start of your header.php script:
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
ob_start();This will tell PHP to buffer the output that is generated by your script, so the header won't be sent to the browser directly.
Maurice Makaay
Phorum Development Team



Re: Display Last 5 Phorum Posts -script August 23, 2006 08:34AM |
Registered: 15 years ago Posts: 3 |
Sorry, only registered users may post in this forum.