Firefox PHP

Hack to display last posts in another document

Posted by Rene 
For some reason, i've not been able to post the attachment - sorry!
(Is it Mozilla 0.9.7, Squid or Phorum?)

So I've put it on my Webserver:

If you "accidently" surf over my homepage: It's in german, I appologize!
And please don't feel disturbed about the ugly Forum software (WBB 1.1.1 - full of bugs!!!!) installed: I've installed Phorum yesterday the first time and had absolutely no idea before, how nice it is! WBB will be replaced with Phorum in near future ;)

Greetings from Bayreuth - Germany,

UPDATE: v0.2 of this Hack will now also show parental folder names!

Demo: [] (sorry, german language only!)
Download: []
Questions: [] (english or german please)

Display a forum ERROR
May 18, 2002 02:57PM
When trying to show a forums header on another page, I keep geting the following error message:

Warning: Cannot add header information - headers already sent by (output started at /home/noshorn/public_html/nya/index.php:15) in /home/noshorn/public_html/nya/forum/common.php on line 348

Now, I'm wondering... Why!? It would be grat if someone could help me... And, one more thing, I'm really a newbie... just starting to lurn a little what php is... So, pleas explain careful for little me... :)
Re: Hack to display last posts in another document
July 26, 2002 12:48AM
OK, I've tried different hacks for this before, couldn't get them working. All I want is the last three thread subjects (no date, author etc.) to show on my home page. Links would be great.

I tried Diana's hack above. I put her entire file into a file named quickforum.php. All I changed was:

$baseurl = "[];;
if (empty($limit)) {
$limit = 3; # default max number of threads to list

Then I included quickforum.php into the appropriate spot on the home page.

What I end up with is this:

It is listing all posts, with the letters new after each link. About half way through it also starts adding authors.

It is picking up the "3" in the echo, but do I need to add that somewhere else as well?

I'm using Phorum 3.3.2a.

Thanks for any help!
hi, i succeded when i installed the hack which allows us to see the last 5 posts (for example) but now i want, if the title of the subject is to long (like hellohello hello hello hello), the title to be short, i mean like "hellohello..."

i know there is already a script (here, on the same page) but i can get it works! the only result of the script is to show "..." after each word!

so, do u have a solutions guys?

I'm using Rene´s modified hack and tried to incorporate the 15-letter limit.
Rene´s hack works great, but the 15-letter limit doesn't work, that is, nothing happens, not even any error msg.

the code is as follows:

// Original hack by Rene displays last 5 postings in forum 1.
//This hack will show the last 3 posted headlines in each forum sectioned by folders if any
chdir("../phorum/"); //again, don't forget to change this to suit your phorum dir.
$curr_par = "";
$par = "";
$number=3; // number of messages to show.

//omit or change the forum name for your test forums.
// we select active forums tables that are not folders
$sSQL="Select id, name, table_name, parent from ".$pho_main." where active=1 and folder='0' and name!='Test' order by parent";
$q->query($DB, $sSQL);
    //get folder name
    if ($rec[parent]>0) {
      $pSQL="Select name from ".$pho_main." where id=$rec[parent]";
      $pq = new query($DB, $pSQL);
      $par = $prec[name];
    $SQL="select id, thread, author, subject, datestamp from $rec[table_name] order by datestamp desc limit $number";
    $nq = new query($DB, $SQL);
    if(is_array($nrec)) {
      if ($curr_par != $par) echo "<br><b>$par</b>";
      $curr_par = $par;
      echo "<br><b><i>$rec[name]</i></b><br>\n";
$subject = explode (" ", $rec[subject]);
$i = 0;
while($subject[$i]) {
if(strlen($subject[$i]) >= 15){ $subject[$i] = substr ($subject[$i], 0, 15)."..."; }
$subject = implode (" ", $subject);
echo "$nrec[author] - <a href=\"$forum_url/$read_page.$ext?f=$rec[id]&i=$nrec[id]&t=$nrec[thread]\" target=\"_blank\"> $nrec[subject]</a><br>\n";

Anyone here with two good php-eyes who could tell me what's wrong?

The solution:

$url = "$forum_url/$read_page.$ext?f=$rec[id]&i=$nrec[id]&t=$nrec[thread]";
if (strlen($nrec['subject']) > 20) {
   $subject = substr($nrec['subject'], 0, 20).'...';
} else {
   $subject = $nrec['subject'];
echo "$nrec[author] - <a href=\"$url\"> $subject</a><br>\n";
$query = "SELECT * FROM `forum_messages` ORDER BY `modifystamp` DESC LIMIT 0,5";
$result = mysql_query($query);

while($recent = mysql_fetch_assoc($result)){
$title = $recent['subject'];
if (strlen($title) > 28) {
$title = substr($title, 0, 28).'...';
<td><img src="images/icon.gif">&nbsp;<a href="./forums/read.php?'.$id.','.$thread.'">'.$title.'</a></td>
Could anyone post the above code by kbking with 15 letter limit and the overall last 5 posts from ALL forums together, not seperately?
Re: Hack to display last posts in another document
November 30, 2004 02:54PM
I'm lost, none of these are working for me, are they compatible with phorum 5.013?
Sorry, you do not have permission to post/reply in this forum.