SimplePortal ile Rastgele Konular Modifikasyonu (Resimli)

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı D®agon

  • Ezberletmez Öğretir
  • *******
  • Join Date: Mar 2008
  • Yer: Ankara
  • 11650
  • +524/-0
  • Cinsiyet: Bay
    • Arif Hocam
[size=12pt]SimplePortal ile Rastgele Konular oluşturabilirsiniz.
[img width=300 height=181]http://www.uyanangenclik.com/gallery/1_04_05_15_1_55_33.jpeg[/img]
simpleportal ile yeni bir php block oluşturun  içine aşağıdaki kodları ekleyin.

[code]global $smcFunc, $scripturl;
$boards = array(107,49,977,105,298);
$request = $smcFunc['db_query']('', '
SELECT t.id_topic, m.subject, m.body
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
WHERE t.id_board IN ({array_int:boards})
ORDER BY RAND()
LIMIT {int:limit}',
array(
'boards' => $boards,
'limit' => 5,
)
);
$topics = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$topics[] = array(
'id_topic' => $row['id_topic'],
'subject' => $row['subject'],
'short_subject' => shorten_subject($row['subject'], 26),
'body' => $row['body'],
'first_image' => preg_match_all('~\[img\]([^\]]+)\[\/img\]~i', $row['body'], $images) ? '<img src="' . $images[1][0] . '" alt="' . $row['subject'] . '" height="50" width="50" />' : '',
);
$smcFunc['db_free_result']($request);

echo '<table style="width: 100%;">';
foreach ($topics as $topic)
if (!empty($topic['first_image']))
echo '
<tr><td style="border: 1px solid rgb(204, 204, 204); width: 51px; height: 51px;">
<a target="_blank" title="', $topic['subject'], '" href="', $scripturl, '?topic=', $topic['id_topic'], '.0">
', $topic['first_image'], '</a></td><td style="border: 1px solid rgb(204, 204, 204);"><a target="_blank" title="', $topic['subject'], '" href="', $scripturl, '?topic=', $topic['id_topic'], '.0">', $topic['subject'], '</a>
</td></tr>';
    else {
echo '<tr><td style="border: 1px solid rgb(204, 204, 204); width: 51px; height: 51px;">
<a target="_blank" title="', $topic['subject'], '" href="', $scripturl, '?topic=', $topic['id_topic'], '.0">
<img src="http://www.uyanangenclik.com/Themes/default/images/sp/post.png" alt="' . $row['subject'] . '" height="50" width="50" /></a></td><td style="border: 1px solid rgb(204, 204, 204);"><a target="_blank" title="', $topic['subject'], '" href="', $scripturl, '?topic=', $topic['id_topic'], '.0">', $topic['subject'], '</a>
</td></tr>';
}     
    echo '</table>';[/code]

[color=red][size=14pt][b]Not:[/b][/size][/color]
[code]$boards = array(107,49,977,105,298);[/code]
Bu kısmı kendinize göre düzenlemyi unutmayın.

Çevrimdışı Zahide

  • *
  • Join Date: Ağu 2015
  • 2
  • +0/-0
  • Cinsiyet: Bayan
Ynt: SimplePortal ile Rastgele Konular Modifikasyonu (Resimli)
« Yanıtla #1 : 02 Ağustos 2015, 13:34:06 »
[color=red][size=14pt][b]Not:[/b][/size][/color]
[code]$boards = array(107,49,977,105,298);[/code]
Bu kısmı kendinize göre düzenlemyi unutmayın.


[b] burasini biraz aciklarmisiniz rica etsem [/b]

Çevrimdışı D®agon

  • Ezberletmez Öğretir
  • *******
  • Join Date: Mar 2008
  • Yer: Ankara
  • 11650
  • +524/-0
  • Cinsiyet: Bay
    • Arif Hocam
Ynt: SimplePortal ile Rastgele Konular Modifikasyonu (Resimli)
« Yanıtla #2 : 03 Ağustos 2015, 09:30:54 »
[quote author=Zahide link=topic=41305.msg70946#msg70946 date=1438511646]
[color=red][size=14pt][b]Not:[/b][/size][/color]
[code]$boards = array(107,49,977,105,298);[/code]
Bu kısmı kendinize göre düzenlemyi unutmayın.


[b] burasini biraz aciklarmisiniz rica etsem [/b]
[/quote]

buradaki sayılar örneğin 107
hangi konulardan rastgele seçileceğini gösteren board numaramız oluyor.
Bir nevi sayfanın adresi diyebiliriz.
Bunuda link yazdığımız yerden görebilirsiniz.