collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 641
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Sohbet Kutusu

Refresh History
  • Destek için kullanmay?n!
  • akorkut: Ama desteklerinizi de bekliyoruz.
    November 18, 2016, 08:41:36 AM
  • akorkut: grafitus hocam, yaklaşık 10 yıl.. smf, sp,  sizin ve diğer paylaşımseverin çalışmalarınızl bize destek oldu. Herşey için çok teşekkür ederiz.
    November 18, 2016, 08:40:38 AM
  • grafitus: Merhabalar herkese. Uzun zaman oldu, hayatlar değişti. Vakit ayıramaz olduk. SMF ve SimplePortal'ın yeri farklı olsa da artık aktif olmadıkları aşikar. Belki bir gün yeniden forumlar doğar. :)) Sevgilerle.
    November 18, 2016, 08:26:32 AM
  • tc bolubeyi: gelen giden yok pek
    July 31, 2016, 02:52:53 PM
  • tekniker974: Neredeyse 1 sene olmuş
    May 12, 2016, 01:05:50 AM
  • tekniker974: Günaydın
    May 12, 2016, 01:05:19 AM
  • tc bolubeyi: merhaba dostlara
    August 28, 2015, 08:56:04 AM
  • mert1i: ker alaka
    August 03, 2015, 10:07:49 AM
  • sonkalem: sa
    July 14, 2015, 03:27:51 PM
  • tc bolubeyi: sağolun ben de iyi allaha şükür
    June 10, 2015, 05:52:54 PM
  • mkuru: Teşekkürler Hasan Bey. Sizi sormalı
    May 27, 2015, 02:53:43 AM
  • tc bolubeyi: selam dostlar nasılsınız
    May 23, 2015, 06:52:15 PM
  • streetfire: Ben seviyorum.
    May 01, 2015, 03:39:22 PM
  • streetfire: Valla bilmiyorum. Sitemde çok kullanıyorum.
    May 01, 2015, 03:39:14 PM
  • mkuru: Evet haklısın
    April 03, 2015, 08:23:32 AM
  • mert1i: portalın en çok istenen ama en aaz talep gören kısmı bu chat
    April 01, 2015, 07:35:31 AM
  • mert1i: Selamun aleyküm ahali..
    January 27, 2015, 05:20:06 AM
  • tekniker974: a.s.
    August 12, 2014, 03:22:53 PM
  • delirium: S.a
    August 02, 2014, 10:24:22 AM
  • tekniker974: :nervous-happy:kimse yok
    July 15, 2014, 01:19:26 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

NEED HELP? If you're looking for support with Simple Portal, look no further than the Support Board!

Author Topic: Rastgele Konu Gösteren Blok yapılabilir mi?  (Read 10971 times)

0 Members and 1 Guest are viewing this topic.

Offline MDFC

  • Semi Newbie
  • *
  • Posts: 8
Rastgele Konu Gösteren Blok yapılabilir mi?
« on: June 29, 2009, 10:46:17 AM »
Rastgele 10 veya daha fazla konu gösteren blok yapabilme ihtimalimiz var mı acaba? Son konular blogu gibi

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Rastgele Konu Gösteren Blok yapılabilir mi?
« Reply #1 on: June 29, 2009, 10:47:13 AM »
SMF sürümünüz nedir?
And slowly, you come to realize... It's all as it should be...

Offline MDFC

  • Semi Newbie
  • *
  • Posts: 8
Re: Rastgele Konu Gösteren Blok yapılabilir mi?
« Reply #2 on: June 29, 2009, 10:49:05 AM »
SMF 2.0 RC1

SimplePortal 2.2.2

Bi konu buldum ama hata veriyo

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Rastgele Konu Gösteren Blok yapılabilir mi?
« Reply #3 on: June 29, 2009, 10:51:06 AM »
Bu kodları PHP bloğunda kullanabilirsiniz:

Code: [Select]
global $context, $settings, $scripturl, $txt, $db_prefix, $user_info;
global $modSettings, $smcFunc;

$num_recent = 10;

if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
$exclude_boards = array($modSettings['recycle_board']);
else
$exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));

// Only some boards?.
if (is_array($include_boards) || (int) $include_boards === $include_boards)
{
$include_boards = is_array($include_boards) ? $include_boards : array($include_boards);
}
elseif ($include_boards != null)
{
$output_method = $include_boards;
$include_boards = array();
}

$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 = $smcFunc['db_query']('substring', '
SELECT
m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, b.id_board, b.name AS board_name, t.num_replies, t.num_views,
IFNULL(mem.real_name, m.poster_name) AS poster_name, ' . ($user_info['is_guest'] ? '1 AS is_read, 0 AS new_from' : '
IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) >= m.id_msg_modified AS is_read,
IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from') . ', SUBSTRING(m.body, 1, 384) AS body, m.smileys_enabled, m.icon
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_last_msg)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
INNER JOIN {db_prefix}messages AS ms ON (ms.id_msg = t.id_first_msg)
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 = {int:current_member})
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:current_member})' : '') . '
WHERE t.id_last_msg >= {int:min_message_id}
' . (empty($exclude_boards) ? '' : '
AND b.id_board NOT IN ({array_int:exclude_boards})') . '
' . (empty($include_boards) ? '' : '
AND b.id_board IN ({array_int:include_boards})') . '
AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}
AND m.approved = {int:is_approved}' : '') . '
ORDER BY RAND()
LIMIT ' . $num_recent,
array(
'current_member' => $user_info['id'],
'include_boards' => empty($include_boards) ? '' : $include_boards,
'exclude_boards' => empty($exclude_boards) ? '' : $exclude_boards,
'min_message_id' => $modSettings['maxMsgID'] - 35 * min($num_recent, 5),
'is_approved' => 1,
)
);
$posts = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br />' => '')));
if ($smcFunc['strlen']($row['body']) > 128)
$row['body'] = $smcFunc['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.
$posts[] = array(
'board' => array(
'id' => $row['id_board'],
'name' => $row['board_name'],
'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>'
),
'topic' => $row['id_topic'],
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'
),
'subject' => $row['subject'],
'replies' => $row['num_replies'],
'views' => $row['num_views'],
'short_subject' => shorten_subject($row['subject'], 25),
'preview' => $row['body'],
'time' => timeformat($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'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" rel="nofollow">' . $row['subject'] . '</a>',
// Retained for compatibility - is technically incorrect!
'new' => !empty($row['is_read']),
'is_new' => empty($row['is_read']),
'new_from' => $row['new_from'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
);
}
$smcFunc['db_free_result']($request);

// Just return it.
if (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['by'], ' ', $post['poster']['link'], '
', !$post['is_new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new" rel="nofollow"><img src="' . $settings['lang_images_url'] . '/new.gif" alt="' . $txt['new'] . '" border="0" /></a>', '
</td>
<td align="right" nowrap="nowrap">
', $post['time'], '
</td>
</tr>';
echo '
</table>';
« Last Edit: June 29, 2009, 10:57:27 AM by [SiNaN] »
And slowly, you come to realize... It's all as it should be...

Offline grafitus

  • Board Moderators
  • *
  • Posts: 1554
  • Gender: Male
  • just looking for own old energy
  • SMF Version: None
  • SP Version: None
Re: Rastgele Konu Gösteren Blok yapılabilir mi?
« Reply #4 on: June 29, 2009, 10:53:31 AM »
SMF 2.0 RC1

SimplePortal 2.2.2

Bi konu buldum ama hata veriyo


Çünkü o kod SMF 1.1.x sürümleri için. Yağız ya da [SiNaN] görürse belki değişik bir şey yazabilirler.. Diyecektim ki [SiNaN] yazmış :)
my modsI don't reply support PMs. Please use support forums.

Offline MDFC

  • Semi Newbie
  • *
  • Posts: 8
Re: Rastgele Konu Gösteren Blok yapılabilir mi?
« Reply #5 on: June 29, 2009, 10:55:34 AM »
Teşekkürederim. Ekledim ama konu göstermiyo. Resimdeki gibi oldu :(


Offline MDFC

  • Semi Newbie
  • *
  • Posts: 8
Re: Rastgele Konu Gösteren Blok yapılabilir mi?
« Reply #6 on: June 29, 2009, 10:56:48 AM »
SMF 2.0 RC1

SimplePortal 2.2.2

Bi konu buldum ama hata veriyo


Çünkü o kod SMF 1.1.x sürümleri için. Yağız ya da [SiNaN] görürse belki değişik bir şey yazabilirler.. Diyecektim ki [SiNaN] yazmış :)

Sağolsun yaptı :) ama olmuyo konu göstermiyo

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Rastgele Konu Gösteren Blok yapılabilir mi?
« Reply #7 on: June 29, 2009, 10:57:49 AM »
Pardon, önceki mesajımdaki kodları düzenledim. Tekrar dener misiniz?
And slowly, you come to realize... It's all as it should be...

Offline MDFC

  • Semi Newbie
  • *
  • Posts: 8
Re: Rastgele Konu Gösteren Blok yapılabilir mi?
« Reply #8 on: June 29, 2009, 11:04:10 AM »
Çok teşekkürederim :) oldu. Ama bişey daha rica edebilirmiyim acaba?

[Kategori]      'Konu Adı'  Gönderen: 'nick'       29 Mart 2009, 22:05:29

yerine

'Konu Adı'  Gönderen: 'nick'

olma şansı var mı?

birde 'nick' in renkli olma olasılığı nedir?

Teşekkürlerr :)

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Rastgele Konu Gösteren Blok yapılabilir mi?
« Reply #9 on: June 29, 2009, 11:13:13 AM »
Bunu deneyin:

Code: [Select]
   global $context, $settings, $scripturl, $txt, $db_prefix, $user_info;
   global $modSettings, $smcFunc, $color_profile;

   $num_recent = 10;

   if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
      $exclude_boards = array($modSettings['recycle_board']);
   else
      $exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));

   // Only some boards?.
   if (is_array($include_boards) || (int) $include_boards === $include_boards)
   {
      $include_boards = is_array($include_boards) ? $include_boards : array($include_boards);
   }
   elseif ($include_boards != null)
   {
      $output_method = $include_boards;
      $include_boards = array();
   }

   $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 = $smcFunc['db_query']('substring', '
      SELECT
         m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, b.id_board, b.name AS board_name, t.num_replies, t.num_views,
         IFNULL(mem.real_name, m.poster_name) AS poster_name, ' . ($user_info['is_guest'] ? '1 AS is_read, 0 AS new_from' : '
         IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) >= m.id_msg_modified AS is_read,
         IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from') . ', SUBSTRING(m.body, 1, 384) AS body, m.smileys_enabled, m.icon
      FROM {db_prefix}topics AS t
         INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_last_msg)
         INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
         INNER JOIN {db_prefix}messages AS ms ON (ms.id_msg = t.id_first_msg)
         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 = {int:current_member})
         LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:current_member})' : '') . '
      WHERE t.id_last_msg >= {int:min_message_id}
         ' . (empty($exclude_boards) ? '' : '
         AND b.id_board NOT IN ({array_int:exclude_boards})') . '
         ' . (empty($include_boards) ? '' : '
         AND b.id_board IN ({array_int:include_boards})') . '
         AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
         AND t.approved = {int:is_approved}
         AND m.approved = {int:is_approved}' : '') . '
      ORDER BY RAND()
      LIMIT ' . $num_recent,
      array(
         'current_member' => $user_info['id'],
         'include_boards' => empty($include_boards) ? '' : $include_boards,
         'exclude_boards' => empty($exclude_boards) ? '' : $exclude_boards,
         'min_message_id' => $modSettings['maxMsgID'] - 35 * min($num_recent, 5),
         'is_approved' => 1,
      )
   );
   $posts = array();
   while ($row = $smcFunc['db_fetch_assoc']($request))
   {
      $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br />' => '')));
      if ($smcFunc['strlen']($row['body']) > 128)
         $row['body'] = $smcFunc['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.
      $posts[] = array(
         'board' => array(
            'id' => $row['id_board'],
            'name' => $row['board_name'],
            'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
            'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>'
         ),
         'topic' => $row['id_topic'],
         'poster' => array(
            'id' => $row['id_member'],
            'name' => $row['poster_name'],
            'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'],
            'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'
         ),
         'subject' => $row['subject'],
         'replies' => $row['num_replies'],
         'views' => $row['num_views'],
         'short_subject' => shorten_subject($row['subject'], 25),
         'preview' => $row['body'],
         'time' => timeformat($row['poster_time']),
         'timestamp' => forum_time(true, $row['poster_time']),
         '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" rel="nofollow">' . $row['subject'] . '</a>',
         // Retained for compatibility - is technically incorrect!
         'new' => !empty($row['is_read']),
         'is_new' => empty($row['is_read']),
         'new_from' => $row['new_from'],
         'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
      );
   }
   $smcFunc['db_free_result']($request);

   // Just return it.
   if (empty($posts))
      return $posts;

$colorids = array();
foreach ($posts as $post)
$colorids[] = $post['poster']['id'];

if (!empty($colorids) && sp_loadColors($colorids) !== false)
{
foreach ($posts as $k => $p)
{
if (!empty($color_profile[$p['poster']['id']]['link']))
$posts[$k]['poster']['link'] = $color_profile[$p['poster']['id']]['link'];
}
}

   echo '
      <table border="0" class="ssi_table">';
   foreach ($posts as $post)
      echo '
         <tr>
            <td>
               <a href="', $post['href'], '">', $post['subject'], '</a>
            </td>
            <td>
               ', $txt['by'], ' ', $post['poster']['link'], '
            </td>
         </tr>';
   echo '
      </table>';
And slowly, you come to realize... It's all as it should be...

Offline MDFC

  • Semi Newbie
  • *
  • Posts: 8
Re: Rastgele Konu Gösteren Blok yapılabilir mi?
« Reply #10 on: June 29, 2009, 11:27:35 AM »
Çok Teşekkü Ederim Oldu :)

Sanırım

   $num_recent = 10;

ten de rastgele gösterilecek konu sayısını değiştire biliyoruz...

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Rastgele Konu Gösteren Blok yapılabilir mi?
« Reply #11 on: June 29, 2009, 11:33:10 AM »
Evet. Konuyu çözüldü olarak işaretledim.
And slowly, you come to realize... It's all as it should be...

Offline MDFC

  • Semi Newbie
  • *
  • Posts: 8
Re: Rastgele Konu Gösteren Blok yapılabilir mi?
« Reply #12 on: June 29, 2009, 11:43:17 AM »
Teşekkürler... Çözüldü:)

Offline yastreb

  • Semi Newbie
  • *
  • Posts: 19
  • Gender: Male
    • http://www.bulgaristanturkleri.com
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Rastgele Konu Gösteren Blok yapılabilir mi?
« Reply #13 on: July 06, 2009, 05:58:01 PM »
aynı kodları arkadaşımın istdiği nick konu adı vs gibi şekilde

1.1.9 içinde verebilirmisiniz

Offline Gurbet_42

  • Full Member
  • ***
  • Posts: 166
  • Gender: Male
    • Müziksiz ilahiler
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: Rastgele Konu Gösteren Blok yapılabilir mi?
« Reply #14 on: July 07, 2009, 01:57:35 PM »
aynı kodları arkadaşımın istdiği nick konu adı vs gibi şekilde

1.1.9 içinde verebilirmisiniz
http://ilahivesohbet.com  -  Müziksiz ilahiler

Offline Gurbet_42

  • Full Member
  • ***
  • Posts: 166
  • Gender: Male
    • Müziksiz ilahiler
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: Rastgele Konu Gösteren Blok yapılabilir mi?
« Reply #15 on: July 22, 2009, 05:52:21 PM »
aynı kodları arkadaşımın istdiği nick konu adı vs gibi şekilde

1.1.10 içinde verebilirmisiniz
http://ilahivesohbet.com  -  Müziksiz ilahiler

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Rastgele Konu Gösteren Blok yapılabilir mi?
« Reply #16 on: July 26, 2009, 01:47:26 PM »
Code: [Select]
global $context, $settings, $scripturl, $txt, $db_prefix, $ID_MEMBER;
global $user_info, $modSettings, $func;

$num_recent = 10;
$exclude_boards = null;
$output_method = 'echo';

if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
$exclude_boards = array($modSettings['recycle_board']);
else
$exclude_boards = empty($exclude_boards) ? array() : $exclude_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, 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 >= " . ($modSettings['maxMsgID'] - 35 * min($num_recent, 5)) . "
AND t.ID_LAST_MSG = m.ID_MSG
AND b.ID_BOARD = t.ID_BOARD" . (empty($exclude_boards) ? '' : "
AND b.ID_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . "
AND $user_info[query_see_board]
AND ms.ID_MSG = t.ID_FIRST_MSG
ORDER BY RAND()
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.
$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' => 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);

// 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'] . '.msg' . $post['new_from'] . ';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>';
And slowly, you come to realize... It's all as it should be...

Offline seLym

  • Semi Newbie
  • *
  • Posts: 10
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: Rastgele Konu Gösteren Blok yapılabilir mi?
« Reply #17 on: November 06, 2009, 08:31:12 PM »
Aynısının belirli bir bölüm için olanını yapabilirmiyiz acaba? 'id' numarasını yazıp falan?

birde karakter sinirlaması olursa çok  güzel olur.

Offline Gurbet_42

  • Full Member
  • ***
  • Posts: 166
  • Gender: Male
    • Müziksiz ilahiler
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: Rastgele Konu Gösteren Blok yapılabilir mi?
« Reply #18 on: November 07, 2009, 03:46:34 PM »
Aynısının belirli bir bölüm için olanını yapabilirmiyiz acaba? 'id' numarasını yazıp falan?

birde karakter sinirlaması olursa çok  güzel olur.

Zaten bölüm haberleri blok bunun içindir.
http://ilahivesohbet.com  -  Müziksiz ilahiler

Offline seLym

  • Semi Newbie
  • *
  • Posts: 10
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: Rastgele Konu Gösteren Blok yapılabilir mi?
« Reply #19 on: November 07, 2009, 04:43:16 PM »
O rastgele değil malesef? ve bu tarzda değil.