SEO-Board: Free, Fast and Search Engine Optimization Friendly Forum Script
»User: »Password:   Remember Me? 
SEO-Board Forum Software Community / General / Programming / {$forum_link} in Mainlastpostcell.htm?
Posted:  25 Mar 2006 13:16   Last Edited By: bronko
Hi,

is ist possible to show the forums name in the last posts section on the index?


Like:
-----------------------
Combine User Database - Comments and Suggestions
by MrLeN
-----------------------


{$topic_link} - {$forum_link} in the mainlastpostcell won't work.


Thanks,
Posted:  25 Mar 2006 16:52
Anything is possible. In board.php you need to change the mysql query to get the forum_id of the post and then to pull the name from the $f_rows array.
Posted:  25 Mar 2006 17:57
Sorry, I'am a PHP newb. Trial and error is my way to handle this hieroglyphic symbols. [smirk]

Do you have another hint for me?


Thanks a lot.
Posted:  25 Mar 2006 22:19
I will experiment with that tomorrow. I will post the code.
Posted:  26 Mar 2006 12:47
In board.php replace this:
Code:

  if (count($userprivateforums)==0)
    $result = mysql_query("SELECT topic_id, topic_title, topic_poster_name, topic_poster_id, topic_lastposter_name, topic_lastposter_id, topic_created_time, topic_lastpost_time, topic_numreplies, topic_numviews, topic_sticky, topic_locked, topic_moved FROM {$dbpref}topics ORDER BY topic_lastpost_time DESC LIMIT $shownumlastposts");
  else
  {
    $where = 'WHERE forum_id<>'.implode(' AND forum_id<>', $userprivateforums);
    $result = mysql_query("SELECT topic_id, topic_title, topic_poster_name, topic_poster_id, topic_lastposter_name, topic_lastposter_id, topic_created_time, topic_lastpost_time, topic_numreplies, topic_numviews, topic_sticky, topic_locked, topic_moved FROM {$dbpref}topics $where ORDER BY topic_lastpost_time DESC LIMIT $shownumlastposts");
  }

with this
Code:

  if (count($userprivateforums)==0)
    $result = mysql_query("SELECT forum_id, topic_id, topic_title, topic_poster_name, topic_poster_id, topic_lastposter_name, topic_lastposter_id, topic_created_time, topic_lastpost_time, topic_numreplies, topic_numviews, topic_sticky, topic_locked, topic_moved FROM {$dbpref}topics ORDER BY topic_lastpost_time DESC LIMIT $shownumlastposts");
  else
  {
    $where = 'WHERE forum_id<>'.implode(' AND forum_id<>', $userprivateforums);
    $result = mysql_query("SELECT forum_id, topic_id, topic_title, topic_poster_name, topic_poster_id, topic_lastposter_name, topic_lastposter_id, topic_created_time, topic_lastpost_time, topic_numreplies, topic_numviews, topic_sticky, topic_locked, topic_moved FROM {$dbpref}topics $where ORDER BY topic_lastpost_time DESC LIMIT $shownumlastposts");
  }


Next replace this code
Code:

      list($id, $title, $author, $author_id, $lastposter, $lastposter_id, $createdtime, $lastposttime, $num_replies, $num_views, $sticky, $locked, $moved) = $row;

with this code
Code:

      list($f_id, $id, $title, $author, $author_id, $lastposter, $lastposter_id, $createdtime, $lastposttime, $num_replies, $num_views, $sticky, $locked, $moved) = $row;


Finally below this line
Code:

      $topic_link = get_topic_link($id, $title, $num_replies+1, 'topiclink');

add this line
Code:

      $forum_link = get_forum_link($f_id, $f_rows[$f_lookup_by_id[$f_id]][3]);


$forum_link now has a link to the forum where the topic was placed.

Last step is, you buy me a beer.
Posted:  27 Mar 2006 10:23
Wow! works great. Thank you very much.