smf Önceki Sonraki yerine konu başlıkları gösterme

admin09.07.2012 - 16:41
Önceki-Sonraki Konu Yerine Konu Başlığı

Display.php

bul

Kod: [Seç]
$context['previous_next'] = $modSettings['enablePreviousNext'] ? '<a href="' . $scripturl . '?topic=' . $topic . '.0;prev_next=prev#new">' . $txt['previous_next_back'] . '</a> <a href="' . $scripturl . '?topic=' . $topic . '.0;prev_next=next#new">' . $txt['previous_next_forward'] . '</a>' : '';
değiştir

Kod: [Seç]
$context['previous_next'] = evo_previous_next();
bul

Kod: [Seç]
?>
üzerine ekle


Kod: [Seç]
// Previous_next Title

function evo_previous_next()
{
   global $smcFunc, $modSettings, $board_info, $scripturl, $txt, $topic, $board, $user_info;
   
   if (!$modSettings['enablePreviousNext'])
      return;
   
   // First super query
   $query = 'SELECT m.subject, m.id_topic
      FROM {db_prefix}topics AS t
         INNER JOIN {db_prefix}topics AS t2 ON (' . (empty($modSettings['enableStickyTopics']) ? '
         t2.id_last_msg {raw:way} t.id_last_msg' : '
         (t2.id_last_msg {raw:way} t.id_last_msg AND t2.is_sticky {raw:way}= t.is_sticky) OR t2.is_sticky {raw:way} t.is_sticky') . ')
         LEFT JOIN {db_prefix}messages AS m ON (t2.id_first_msg = m.id_msg)
      WHERE t.id_topic = {int:current_topic}
         AND t2.id_board = {int:current_board}' . (!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : '
         AND (t2.approved = {int:is_approved} OR (t2.id_member_started != {int:id_member_started} AND t2.id_member_started = {int:current_member}))') . '
      ORDER BY' . (empty($modSettings['enableStickyTopics']) ? '' : ' t2.is_sticky{raw:order},') . ' t2.id_last_msg{raw:order}
      LIMIT 1';
     
   // No luck? try with this!
   $query2 = 'SELECT m.subject, m.id_topic
         FROM {db_prefix}topics AS t
            LEFT JOIN {db_prefix}messages AS m ON (m.id_topic = t.id_first_msg)
         WHERE t.id_board = {int:current_board}' . (!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : '
            AND (t.approved = {int:is_approved} OR (t.id_member_started != {int:id_member_started} AND t.id_member_started = {int:current_member}))') . '
         ORDER BY' . (empty($modSettings['enableStickyTopics']) ? '' : ' t.is_sticky{raw:order},') . ' t.id_last_msg{raw:order}
         LIMIT 1';
     
   // Seek first title!
   $request = $smcFunc['db_query']('', $query,
      array(
         'current_board' => $board,
         'current_member' => $user_info['id'],
         'current_topic' => $topic,
         'is_approved' => 1,
         'id_member_started' => 0,
         'way' => '>',
         'order' => '',
      )
   );

   // Nothing? try simple!
   if ($smcFunc['db_num_rows']($request) == 0)
   {
      $smcFunc['db_free_result']($request);

      $request = $smcFunc['db_query']('', $query2,
         array(
            'current_board' => $board,
            'current_member' => $user_info['id'],
            'is_approved' => 1,
            'id_member_started' => 0,
            'order' => '',
         )
      );
   }

   // Finally!
   list ($prev_subject, $prev_id) = $smcFunc['db_fetch_row']($request);
   $smcFunc['db_free_result']($request);
         
   // First query for next topic
   $request = $smcFunc['db_query']('', $query,
      array(
         'current_board' => $board,
         'current_member' => $user_info['id'],
         'current_topic' => $topic,
         'is_approved' => 1,
         'id_member_started' => 0,
         'way' => '<',
         'order' => ' DESC',
      )
   );

   // If no luck, try with this!
   if ($smcFunc['db_num_rows']($request) == 0)
   {
      $smcFunc['db_free_result']($request);

      $request = $smcFunc['db_query']('', $query2,
         array(
            'current_board' => $board,
            'current_member' => $user_info['id'],
            'is_approved' => 1,
            'id_member_started' => 0,
            'order' => ' DESC',
         )
      );
   }

   // Gotcha!
   list ($next_subject, $next_id) = $smcFunc['db_fetch_row']($request);
   $smcFunc['db_free_result']($request);
   
   return '<a href="' . $scripturl . '?topic=' . $prev_id . '.0">&laquo; ' . $prev_subject . '</a> | <a href="' . $scripturl . '?topic=' . $next_id . '.0">' . $next_subject . ' &raquo;</a>';
}


Linkback: https://www.buyuknet.com/smf-onceki-sonraki-yerine-konu-basliklari-gosterme-t38242.0.html

Etiket:
smf önceki sonraki 

Bu bilgi size yardimci oldu mu?

EvetHayır
smf Önceki Sonraki yerine konu başlıkları gösterme
smf Önceki Sonraki yerine konu başlıkları gösterme
(Ortalama: 5 üzerinden 2.5 - 2 Oy)
2