Firefox PHP

Display Last 5 Phorum Posts -script

Posted by dagon 
Re: What did I forget
September 30, 2004 03:34PM
Put the top5 script in your Phorum dir and all will be fine.

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
z5
Re: What did I forget
September 30, 2004 04:05PM
Thanks for fast reply, but it still doesn't work.

I've put the top 5 script into my phorum drawer and changed it:

include_once("common.php"); (because common.php is now in the same drawer as the top 5 script)

On my index page (not the phorum index page), i changed:

include_once("phorum/phorum5_top5.php");

But i still get the same error code.
Re: Display Last 5 Phorum Posts -script
September 30, 2004 09:49PM
sorry, I didn't realize you were including the top5 script. In that case, you will need to chdir() to the phorum dir before you include it.

chdir('phorum');

The only problem here is the code that comes after that. It will now be running in the phorum dir. So, may need to do this:

$curdir=getcwd();
chdir('phorum');
include_once("./top5.php");
chdir($curdir);

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
z5
Re: Display Last 5 Phorum Posts -script
October 01, 2004 12:53PM
Works now :) Thanks a lot!
z5
Re: Display Last 5 Phorum Posts -script
October 01, 2004 02:08PM
Damn, i was too fast. It worked but not anymore :(
Well, it does (i see the topics) but i do get the following error message at the beginning:

Warning: Cannot add header information - headers already sent by (output started at c:\program files\easyphp\www\header.php:13) in c:\program files\easyphp\www\phorum\include\users.php on line 65

Is this because i'm including a header.php allready in my own pages?
Re: Display Last 5 Phorum Posts -script
October 02, 2004 12:26PM
This is because in your index page, your code "include bla bla bla" is not befor any html tags....

You must include all your files needed befor any html tags.

__________________________________________________
With kind regards, Mark W. K.
[www.adrenalyne.com] (french site)
Re: Display Last 5 Phorum Posts -script
October 06, 2004 04:54AM
Please let me know, how to implement this snippet. I need it urgently.
Re: Display Last 5 Phorum Posts -script
October 23, 2004 03:51AM
Is it possible to configure this to last 5 topics instead of last 5 posts?

Sergej

------------------------------------------
^AU^ Assassins United
[www.assassinsunited.com]
------------------------------------------
Re: Display Last 5 Phorum Posts -script
November 26, 2004 10:00AM
Hello,

I have changed a little bit the code to prevent from the "headers already sent " problem.

1. In the page where you want to display the last x posts, simply write :
<?php
include("phorum/topx.php");
?>

you can change "phorum" to match your phorum install dir.

2. create a file, called "topx.php", copy/paste the code below, fill with your mysql settings, the number of message you want to be display, and upload this file in the root of the phorum install dir. You can change the html output code to match your need.

<?
/*
Display Last x Phorum Posts
tested on phorum 5.0.13a
26 Nov 2004 (3)
created by boyd~at~eldritchdark~dot~com (Boyd Pearson).
modified by T. Vanneste on 2004/11/26
free to be used and abused as you feel fit.
*/
$host = "xxxx"; // your mysql hostname
$dbuser = "xxxx"; // your mysql username
$dbpass = "xxxx"; // your mysql password
$dbname = "xxxx"; // your mysql db name
$table = "phorum_messages"; // your phorum messages table name
$forum_table = "phorum_forums"; // your phorum main table name
$phorumdirname = "phorum"; // name of the phorum install dir.
$number = x ; // number of messages to show.

@$con=mysql_connect($host,$dbuser,$dbpass) or die ("cannot connect to MySQL");
$select_db = mysql_select_db($dbname,$con);
$result = mysql_query("select * from $table m, $forum_table f where m.forum_id = f.forum_id order by m.datestamp desc limit $number") or die("Failed Query of " . $result. mysql_error());

echo "<div align=\"left\" class=\"texte\">"; // replace "texte" with your css class
while($row = mysql_fetch_array($result)){
$row[datestamp] = strftime("%m/%d/%y %H:%M", $row["datestamp"]); // if french use "%d/%m/%y %H:%M"
echo "&nbsp;<img src=\"phorum/templates/default/images/carat.gif\"> ".$row[datestamp];
echo " Forum ". $row[name].":</small>";
echo "<br>&nbsp;&nbsp;<a href=\"".$phorumdirname."/read.php?". $row[forum_id].",".$row[thread].",".$row[message_id]."#".$row[message_id]."\">" .$row[subject]. "</a><br><br>";
}
echo "</div>";
?>

Have fun,
Thierry



Edited 8 time(s). Last edit at 11/30/2004 07:11AM by thva.
Re: Display Last 5 Phorum Posts -script
December 06, 2004 05:30PM
I am having a very strange problem with this script- it happens ONLY in the Firefox browser.
Every once in a while I get this error instead of displaying the most recent posts:
Lost connection to MySQL server during query: select * from phorum_forums order by display_order ASC, name

Now the really wierd part is that it only happens once my page gets to a certain length - if I delete some of the text from the page, then it accessing the database find again and displayed the posts. Any ideas what this might be? perhaps this is a bug with Firefox...
jet
Sorry, only registered users may post in this forum.

Click here to login