Önceki Sonraki yerine Konu İsimleri

Başlatan DaHiLeaYSe, 04 Ara 2014 22:43

« önceki - sonraki »

0 Üye ve 1 Ziyaretçi konuyu incelemekte.



  1. 632

  2. 251

Display.php'de

Kod (bul) 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>' : '';

Kod (değiştir) Seç
$context['previous_next'] = evo_previous_next();
Kod (bul) Seç
?>

Kod (Öncesine Ekle) 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>';
}

*

  1. 277

  2. 41

  3. 17
Deneyen varmı görüntüsü nasıl oluyor acaba ?



  1. 632

  2. 251
Alıntı yapılan: rock3r - 05 Ara 2014 05:16Deneyen varmı görüntüsü nasıl oluyor acaba ?


Paylaştığım tüm modlar denenmiştir. Demo olarak siteme bakabilirsiniz.


MENU ×