News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

SSI vraagje

Started by Jermain, September 11, 2005, 09:00:11 AM

Previous topic - Next topic

Jermain

Mensen,

Ik wil op mijn site in m'n sidebar de recente topic's van het bijhorende forum weergeven.
Ik gebruik nu <?php ssi_recentTopics(); ?> maar dit laat behalve de topictitel, ook nog andere informatie zien zoals het board waarop het topic staat, en nog de datum en tijd. Wat ik nu wil is dat alleen de topictitel word weergegeven, en evt. de user waardoor de laatste post is gedaan, maar meer niet, omdat dit te lang is voor de lay-out.

Heb al een tijdje zitten googlen, en ook uiteraard op dit forum gekeken (ook de SSI FAQ's) maar kom niet tot een oplossing, misschien dat iemand mij dat hier kan vertellen?

Alvast bedankt, Jermain

Aaron

Je zult hier SSI.php in een teksteditor als Wordpad moeten openen, en dan de code moeten aanpassen. Er is naar zover ik kan zien geen parameterwaarde die zorgt voor een customized output...

Aaron.

Jermain

Zoiets had ik al gelezen idd ja, maar ik snap niet echt wat ik weg moet halen uit de code
Ik neem aan dat dit het gedeelte is wat veranderd moet worden:

Quote// Recent topic list:   [board] Subject by Poster   Date
function ssi_recentTopics($num_recent = 8, $exclude_boards = array(), $output_method = 'echo')
{
   global $context, $settings, $scripturl, $txt, $db_prefix, $ID_MEMBER, $user_info, $modSettings;

   // Find all the posts in distinct topics.  Newer ones will have higher IDs.
   $request = db_query("
      SELECT
         m.posterTime, ms.subject, hxxp:m.id [nonactive]_TOPIC, hxxp:m.id [nonactive]_MEMBER, hxxp:m.id [nonactive]_MSG, hxxp:b.id [nonactive]_BOARD, hxxp:b.name [nonactive] AS bName,
         IFNULL(mem.realName, m.posterName) AS posterName, " . ($user_info['is_guest'] ? '1 AS isRead, 0 AS logTime' : '
         IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) >= GREATEST(m.posterTime, m.modifiedTime) AS isRead,
         IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) AS logTime') . "
      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 = hxxp:m.id [nonactive]_MEMBER)" . (!$user_info['is_guest'] ? "
         LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = hxxp:t.id [nonactive]_TOPIC AND hxxp:lt.id [nonactive]_MEMBER = $ID_MEMBER)
         LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = hxxp:b.id [nonactive]_BOARD AND hxxp:lmr.id [nonactive]_MEMBER = $ID_MEMBER)" : '') . "
      WHERE hxxp:m.id [nonactive]_MSG >= " . ($modSettings['maxMsgID'] - 8 * $num_recent) . "
         AND hxxp:t.id [nonactive]_LAST_MSG = hxxp:m.id [nonactive]_MSG
         AND hxxp:b.id [nonactive]_BOARD = hxxp:t.id [nonactive]_BOARD" . (empty($exclude_boards) ? '' : "
         AND hxxp:b.id [nonactive]_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . "
         AND $user_info[query_see_board]
         AND hxxp:ms.id [nonactive]_MSG = hxxp:t.id [nonactive]_FIRST_MSG
      ORDER BY hxxp:m.id [nonactive]_MSG DESC
      LIMIT $num_recent", __FILE__, __LINE__);
   $posts = array();
   while ($row = mysql_fetch_assoc($request))
   {
      // Censor the subject.
      censorText($row['subject']);

      // Build the array.
      $posts[] = 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' => $row['ID_TOPIC'],
         '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' => strlen(un_htmlspecialchars($row['subject'])) > 25 ? htmlspecialchars(substr(un_htmlspecialchars($row['subject']), 0, 22) . '...') : $row['subject'],
         'time' => timeformat($row['posterTime']),
         'timestamp' => $row['posterTime'],
         'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . ';topicseen#msg' . $row['ID_MSG'],
         'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#msg' . $row['ID_MSG'] . '">' . $row['subject'] . '</a>',
         'new' => !empty($row['isRead']),
         'newtime' => $row['logTime']
      );
   }
   mysql_free_result($request);

   // Just return it.
   if ($output_method != 'echo' || empty($posts))
      return $posts;

   echo '
      <table border="0" class="ssi_table">';
   foreach ($posts as $post)
      echo '
         <tr>
            <td align="right" valign="top" nowrap="nowrap">
               [', $post['board']['link'], ']
            </td>
            <td valign="top">
               <a href="', $post['href'], '">', $post['subject'], '</a>
               ', $txt[525], ' ', $post['poster']['link'], '
               ', $post['new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.from' . $post['newtime'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>', '
            </td>
            <td align="right" nowrap="nowrap">
               ', $post['time'], '
            </td>
         </tr>';
   echo '
      </table>';
}

Compuart

Je kunt de output-methode wijzigen door dat als parameter mee te geven. Bijvoorbeeld:

<?php
$posts
= ssi_recentTopics(8, null, 'return');

foreach (
$posts as $post)
   echo
$post['link'], '<br />';

?>
Hendrik Jan Visser
Former Lead Developer & Co-founder www.simplemachines.org
Personal Signature:
Realitynet.nl -> ExpeditieRobinson.net / PekingExpress.org / WieIsDeMol.Com

Advertisement: