TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,911
  • Total Topics: 21,307
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 359
  • Total: 360
  • tino

Re: "recent topics" in SMF style [Include Boards]

Started by insanemustang, January 07, 2009, 08:38:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

insanemustang

I could understand if it didn't display any, but for it to display just 4... it's suspicious to say the least.  And the new.gif icon still doesn't take me to the latest post in the thread like it's supposed to :(

BTW, I have SMF 1.1.7 and TP 1.0.5 Beta 1

JPDeni

Since it's working right in one, the logic must be right. There's something else going on.

Try changing


WHERE t.ID_LAST_MSG >= " . ($modSettings['maxMsgID'] - 35 * min($num_recent, 5)) . "
AND t.ID_LAST_MSG = m.ID_MSG



to


WHERE t.ID_LAST_MSG = m.ID_MSG


Basically, you're just taking out some code. I'm wondering if there just aren't enough posts that are recent enough to fill out the list. We'll see from this whether that's true or not. I think. :)

I'd have to look at your site to get an idea of why the New .gif isn't working.

insanemustang

Quote from: JPDeni on January 09, 2009, 09:41:47 PM
Since it's working right in one, the logic must be right. There's something else going on.

Try changing


WHERE t.ID_LAST_MSG >= " . ($modSettings['maxMsgID'] - 35 * min($num_recent, 5)) . "
AND t.ID_LAST_MSG = m.ID_MSG



to


WHERE t.ID_LAST_MSG = m.ID_MSG


Basically, you're just taking out some code. I'm wondering if there just aren't enough posts that are recent enough to fill out the list. We'll see from this whether that's true or not. I think. :)

I'd have to look at your site to get an idea of why the New .gif isn't working.


BINGO!  Thank you so much, this has disturbed me for months.

The actual gif is working, the link for the graphic doesn't work.  Site is http://www.bamanation.net

insanemustang


insanemustang

Quote from: insanemustang on January 13, 2009, 03:30:00 PM
any idea about the new.gif ?

anyone?  when i click the new.gif it takes me to a page with nothing on it

ZarPrime

InsaneM,

You appear to have 3 different blocks on your site for 3 different boards.  Are you using the same code in all 3?

Please post the most current code you are using here inside BBC code tags, and somebody will be able to take a look at the problem.  Is the only problem that clicking the new.gif doesn't take you to the newest messages or are there other issues as well?

Also, whoever looks at this for you will probably need for you to setup a temp Admin account for them so you might as well go ahead and set it up and be prepared to PM them the details once they ask for them.

ZarPrime

insanemustang

Ok,

The only problem I am experiencing is that the new.gif doesn't take you to the newest post in that thread, instead it takes you to this weird url

"...index.php?topic=Array.from#new"

Here is a the code from one of my blocks

global $context, $settings, $scripturl, $txt, $db_prefix, $ID_MEMBER;
global $user_info, $modSettings, $func;

$num_recent = 6;
$include_boards = array(26,62,63);

$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

  $include_boards = empty($include_boards) ? array() : $include_boards;

  $stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
  $icon_sources = array();
  foreach ($stable_icons as $icon)
    $icon_sources[$icon] = 'images_url';

// Find all the posts in distinct topics.  Newer ones will have higher IDs.
  $request = db_query("
SELECT
m.posterTime, ms.subject, m.ID_TOPIC, t.numReplies, m.ID_MEMBER, m.ID_MSG, b.ID_BOARD, b.name AS bName,
IFNULL(mem.realName, m.posterName) AS posterName, " . ($user_info['is_guest'] ? '1 AS isRead, 0 AS new_from' : '
IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) >= m.ID_MSG_MODIFIED AS isRead,
IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from') . ", LEFT(m.body, 384) AS body, m.smileysEnabled, m.icon
FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}messages AS ms)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)" . (!$user_info['is_guest'] ? "
LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = b.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)" : '') . "
WHERE t.ID_LAST_MSG = m.ID_MSG
                        AND b.ID_BOARD = t.ID_BOARD" . (empty($include_boards) ? '' : "
AND b.ID_BOARD IN (" . implode(', ', $include_boards) . ")") . "
" . ((!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0) ? "
AND b.ID_BOARD != '$modSettings[recycle_board]'" : '') . "
AND $user_info[query_see_board]
AND ms.ID_MSG = t.ID_FIRST_MSG
ORDER BY t.ID_LAST_MSG DESC
LIMIT $num_recent", __FILE__, __LINE__);
  $posts = array();
  while ($row = mysql_fetch_assoc($request))
  {
    $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']), array('<br />' => '
')));
    if ($func['strlen']($row['body']) > 128)
      $row['body'] = $func['substr']($row['body'], 0, 128) . '...';

// Censor the subject.
      censorText($row['subject']);
      censorText($row['body']);

      if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
        $icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';

// Build the array.
$result[] = array(
                        'board' => array(
                                                'id' => $row['ID_BOARD'],
                                                'name' => $row['bName'],
                                                'href' => $scripturl . '?board=' . $row['ID_BOARD'] . '.0',
                                                'link' => '<a href="' . $scripturl . '?board=' . $row['ID_BOARD'] . '.0">' . $row['bName'] . '</a>'
),
                        'topic' => array(
'id' => $row['ID_TOPIC'],
'views' => $row['numViews'],
'replies' => $row['numReplies'],
),
                                                'poster' => array(
                                                'id' => $row['ID_MEMBER'],
                                                'name' => $row['posterName'],
                                                'href' => empty($row['ID_MEMBER']) ? '' : $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
                                                'link' => empty($row['ID_MEMBER']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>'
       ),
                        'subject' => $row['subject'],
                        'short_subject' => shorten_subject($row['subject'], 25),
                        'preview' => $row['body'],
                        'time' => timeformat($row['posterTime']),
                        'timestamp' => forum_time(true, $row['posterTime']),
                        'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . ';topicseen#new',
                        'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#new">' . $row['subject'] . '</a>',
                        'new' => !empty($row['isRead']),
                        'new_from' => $row['new_from'],
                        'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
);
}

mysql_free_result($request);

// Print out the results
  echo '<blockquote><img src="http://www.bamanation.net/images/websitenews.png"></blockquote>';
   echo '<span class="smalltext">';
foreach($result as $my){
  echo "$bullet";
  echo '<span class="normaltext">'.$my['link'],' ';
  echo '(', '<span class="smalltext">'.$my['topic']['replies'],') ';
  // is this topic new? (assume they are logged in)
  if (!$my['new'] && $context['user']['is_logged'])
  echo '<a href="', $scripturl, '?topic=', $my['topic'], '.from', $my['newtime'], '#new">
    <img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
  echo '</span>';
  echo '<span class="largetext">','<br>';
}


Thank for any and all help.

JPDeni

This is not right:

  echo '<a href="', $scripturl, '?topic=', $my['topic'], '.from', $my['newtime'], '#new">


The reason you're getting Array is that the $my['topic'] is an array.


                        'topic' => array(
'id' => $row['ID_TOPIC'],
'views' => $row['numViews'],
'replies' => $row['numReplies'],
),


The from text is something that you've put in there and there is no ['newtime'] defined, so you get nothing from that. (You also likely are getting an error in your error log.)

I'm not sure what it is that you're wanting to do. If you want to send people to the most recent post in a topic, use


echo '<a href="' . $my['href'] . '">

insanemustang

#28
Thanks for the help, I'm going to try it now.

insanemustang

Replaced

echo '<a href="', $scripturl, '?topic=', $my['topic'], '.from', $my['newtime'], '#new">

with

echo '<a href="' . $my['href'] . '">

and got

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home3/insanem2/public_html/bamanation/Sources/Load.php(1754) : eval()'d code(48) : eval()'d code on line 94

This website is proudly hosted on Crocweb Cloud Website Hosting.