Firefox PHP

Last post listing on index page

Posted by Brian Moon 
Re: Last post listing on index page
February 09, 2007 10:45PM
Quote
statolith
Pardon my PHP-ignorance, but why can't I put an image in the formatting line? i.e. the line that starts "$forum["last_post"]=" I just wanted to put a little carat image after the user name, but I get an error:

Quote

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/.harpa/lptjkt/mountain-goats.com/forums/mods/lastforumpost/lastforumpost.php on line 13)

I'm not bungling the html, as far as I can tell.

Also, I'd like to put the last post info below the datestamp. Help?
you need to show us like 13 to know whether you bungled it or not.

to relocate it you need to edit the template, and find where it puts {FORUM->description}, just move that to the location you want it to appear.

here line 13 in my file:
$forum["description"]="<div style='margin-bottom: 5px;'><strong>{$PHORUM['DATA']['LANG']['LastPost']}</strong>: <a href='$url'>$message[subject]</a> {$PHORUM['DATA']['LANG']['by']} $message[author]</div>".$forum["description"];

where do you want your image? here's one thought:
$forum["description"]="<div style='margin-bottom: 5px;'><strong>{$PHORUM['DATA']['LANG']['LastPost']}</strong>: <a href='$url'>$message[subject]</a> {$PHORUM['DATA']['LANG']['by']} $message[author]<img src='[PATH_TO_IMAGE&];</div>".$forum["description"];
my guess is you're messing up the quoting.. since it's in double-quotes ("), you need to use single quotes (') in your html pieces or you'll mess up the parser. or escape double-quotes (\") where you insist on having them.
Re: Last post listing on index page
February 09, 2007 11:05PM
Single quotes! I knew it would be something easy like that. Thanks!

I've moved the last post info out from the description field, over to the 'Last Post' column. It's showing up there, but I'd like it to show below the datestamp.
Re: Last post listing on index page
February 09, 2007 11:16PM
Quote
statolith
SinIt's showing up there, but I'd like it to show below the datestamp.
change line 13 from:
$forum["last_post"]="<strong>{$PHORUM['DATA']['LANG']['LastPost']}</strong>: <a href='$url'>$message[subject]</a> {$PHORUM['DATA']['LANG']['by']} $message[author]<br />".$forum["last_post"];
to
$forum["last_post"]=$forum["last_post"]."<br /><strong>{$PHORUM['DATA']['LANG']['LastPost']}</strong>: <a href='$url'>$message[subject]</a> {$PHORUM['DATA']['LANG']['by']} $message[author]";

$forum["last_post"] at this point in time contains the datestamp. the first bit of code APPENDS this at the end of your new info. the 2nd bit of code puts this first and appends the message info.

EDIT: moved the "<br />" to the beginning of the added bits so that it formats nicely...but modify this to suit your look & feel



Edited 2 time(s). Last edit at 02/09/2007 11:17PM by freedman.
Re: Last post listing on index page
February 09, 2007 11:27PM
Perfect! Thank you.
Re: Last post listing on index page
July 04, 2007 07:40AM
Works fine, but... Well, is there any option to truncate the topic? The topics sometimes are huge and destroy the layout. There is a module for truncating, maybe there is an idea to add this setting to the truncate module?

___
Polskie Centrum WebKomiksu
Re: Last post listing on index page
September 20, 2007 12:37AM
Quote
godai
Works fine, but... Well, is there any option to truncate the topic? The topics sometimes are huge and destroy the layout. There is a module for truncating, maybe there is an idea to add this setting to the truncate module?

Quote
Ulf Dunkel
Another formatting suggestion:
$forum["last_post"] = "<a href='$url'>".substr($message[subject],0,30)."...</a><br/>{$PHORUM['DATA']['LANG']['by']} $message[author]<br />" . $forum["last_post"];


Is this mod now outdated for version 5.1.25? I have the entire folder uploaded into the mods directory, and I turned it on, but it's not showing on the index page (using index_new.php).

<?php
function mod_last_forum_post($forums) {
  $PHORUM = $GLOBALS["PHORUM"];
  foreach($forums as $key=>$forum) {
    if(!$forum["folder_flag"]) {
      $message = array_shift(phorum_db_get_recent_messages(1, $forum["forum_id"]));
      $url = phorum_get_url(PHORUM_FOREIGN_READ_URL, $message["forum_id"], $message["thread"], $message["message_id"]); 
      $forum["last_post"] = "<a href='$url'>".substr($message[subject],0,30)."...</a><br/>{$PHORUM['DATA']['LANG']['by']} $message[author]<br />" . $forum["last_post"];
      $forums[$key] = $forum;
    }
  }
  return $forums;
}
?>

-------------------------------------------

"Everything we see or seem, is but a dream within a dream." -Edgar Allan Poe
Re: Last post listing on index page
December 05, 2007 08:22PM
I tried installing this mod on 5.2.2-beta, and got some odd results.

The links are appearing, but they aren't correctly corresponding to the forums. (probably because I've moved them around a bit and put some in folders - flat view) ie. the message displayed is not from the correct forum.

Also, they are displaying in the left-hand (forum description) column, instead of the right-hand (last post date) column.
Re: Last post listing on index page
February 28, 2008 02:43PM
New mod is now available for 5.2 here:

[www.phorum.org]

Thanks Maurice!

...
Steve H, currently on: (version 5.2.23)
contributions:
Birthdays mod, Top Users mod, Icon legend.tpl, (plus a handful of bugfixes and old 5.0 creations)
Sorry, only registered users may post in this forum.

Click here to login