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: 389
  • 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]

Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Author Topic: [Blok]Rastgele Konu  (Read 7587 times)

0 Members and 1 Guest are viewing this topic.

Offline Paragaya

  • Jr. Member
  • **
  • Posts: 91
  • Gender: Male
  • Heyo Basit Portal :D
  • SMF Version: None
  • SP Version: None
[Blok]Rastgele Konu
« on: February 22, 2009, 04:55:15 AM »

A?a??daki kodu bir php blok a kaydederseniz rastgele bir konu görüntüler :)

Code: [Select]
global $scripturl, $db_prefix, $txt, $settings, $modSettings, $context;
global $func;
$length= 300;

loadLanguage('Stats');

if ($length === null)
$length = isset($_GET['length']) ? (int) $_GET['length'] : 0;
else
$length = (int) $length;

// Make sure guests can see this board.
$request = db_query("
SELECT ID_BOARD
FROM {$db_prefix}boards
WHERE FIND_IN_SET(-1, memberGroups)
        ORDER BY rand()
LIMIT 1", __FILE__, __LINE__);

list ($board) = mysql_fetch_row($request);
mysql_free_result($request);

// Load the message icons - the usual suspects.
$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 the post ids.
$request = db_query("
SELECT ID_FIRST_MSG
FROM {$db_prefix}topics
WHERE ID_BOARD = $board
ORDER BY rand()
LIMIT 1", __FILE__, __LINE__);
$posts = array();
while ($row = mysql_fetch_assoc($request))
$posts[] = $row['ID_FIRST_MSG'];
mysql_free_result($request);

// Find the posts.
$request = db_query("
SELECT
m.icon, m.subject, m.body, IFNULL(mem.realName, m.posterName) AS posterName, m.posterTime,
t.numReplies, t.ID_TOPIC, m.ID_MEMBER, m.smileysEnabled, m.ID_MSG, t.locked
FROM ({$db_prefix}topics AS t, {$db_prefix}messages AS m)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
WHERE t.ID_FIRST_MSG IN (" . implode(', ', $posts) . ")
AND m.ID_MSG = t.ID_FIRST_MSG
LIMIT 1", __FILE__, __LINE__);
$return = array();
while ($row = mysql_fetch_assoc($request))
{
// If we want to limit the length of the post.
if (!empty($length) && $func['strlen']($row['body']) > $length)
{
$row['body'] = $func['substr']($row['body'], 0, $length);
// The first space or line break. (<br />, etc.)
        $cutoff = max(strrpos($row['body'], ' '), strrpos($row['body'], '<'));

if ($cutoff !== false)
$row['body'] = $func['substr']($row['body'], 0, $cutoff);
$row['body'] .= '...';
}

$row['body'] = parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']);

// Check that this message icon is there...
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';

censorText($row['subject']);
censorText($row['body']);

$return[] = array(
'id' => $row['ID_TOPIC'],
'message_id' => $row['ID_MSG'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
'subject' => $row['subject'],
'time' => timeformat($row['posterTime']),
'timestamp' => forum_time(true, $row['posterTime']),
'body' => $row['body'],
'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0">' . $row['numReplies'] . ' ' . ($row['numReplies'] == 1 ? $txt['smf_news_1'] : $txt['smf_news_2']) . '</a>',
'replies' => $row['numReplies'],
'comment_href' => !empty($row['locked']) ? '' : $scripturl . '?action=post;topic=' . $row['ID_TOPIC'] . '.' . $row['numReplies'] . ';num_replies=' . $row['numReplies'],
'comment_link' => !empty($row['locked']) ? '' : '<a href="' . $scripturl . '?action=post;topic=' . $row['ID_TOPIC'] . '.' . $row['numReplies'] . ';num_replies=' . $row['numReplies'] . '">' . $txt['smf_news_3'] . '</a>',
'new_comment' => !empty($row['locked']) ? '' : '<a href="' . $scripturl . '?action=post;topic=' . $row['ID_TOPIC'] . '.' . $row['numReplies'] . '">' . $txt['smf_news_3'] . '</a>',
'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']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>' : $row['posterName']
),
'locked' => !empty($row['locked']),
);
}
mysql_free_result($request);

foreach ($return as $news)
{
echo '
<div>
<a href="', $news['href'], '">', $news['icon'], '</a> <b>', $news['subject'], '</b>
<div class="smaller">', $news['time'], ' ', $txt[525], ' ', $news['poster']['link'], '</div>

<div class="post" style="padding: 2ex 0;">', $news['body'], '</div>

', $news['link'], $news['locked'] ? '' : ' | ' . $news['comment_link'], '
</div>';
}

Offline MUSTAFAINE

  • Semi Newbie
  • *
  • Posts: 16
  • Gender: Male
    • Metal Up Your ASS!!!
  • SMF Version: 2 RC1.2
  • SP Version: 2.3
Re: [Blok]Rastgele Konu
« Reply #1 on: April 27, 2009, 11:05:07 AM »
tesekkurler hos paylasim


Offline Paragaya

  • Jr. Member
  • **
  • Posts: 91
  • Gender: Male
  • Heyo Basit Portal :D
  • SMF Version: None
  • SP Version: None
Re: [Blok]Rastgele Konu
« Reply #2 on: April 29, 2009, 02:54:10 AM »
önemli deil.

Offline MDFC

  • Semi Newbie
  • *
  • Posts: 8
Re: [Blok]Rastgele Konu
« Reply #3 on: June 29, 2009, 10:48:19 AM »
Fatal error: Call to undefined function db_query() in /home/meshlcom/public_html/sozluk/Sources/SPortal2.php(3218) : eval()'d code on line 13

hatası veriyo :(

Offline kral

  • Semi Newbie
  • *
  • Posts: 25
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: [Blok]Rastgele Konu
« Reply #4 on: March 26, 2010, 11:12:57 AM »
yalnız bu konuda ilgili konularda resim var ise resim olğu gibi çıkıyor. Yani resim büyük ise sağ veya sol bloklarda çok büyük çıkıyor.

Offline grafitus

  • Board Moderators
  • *
  • Posts: 1554
  • Gender: Male
  • just looking for own old energy
  • SMF Version: None
  • SP Version: None
Re: [Blok]Rastgele Konu
« Reply #5 on: March 26, 2010, 12:17:28 PM »
yalnız bu konuda ilgili konularda resim var ise resim olğu gibi çıkıyor. Yani resim büyük ise sağ veya sol bloklarda çok büyük çıkıyor.
Kodun $length300; ifadesinideki 300 karakter sınırını düşürün.
my modsI don't reply support PMs. Please use support forums.

Offline kral

  • Semi Newbie
  • *
  • Posts: 25
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: [Blok]Rastgele Konu
« Reply #6 on: March 26, 2010, 12:45:08 PM »
olmuyor. 487 x 700 piksel olan bir resmi mesela sağ blokta gösteriyor ama bu resmi sağ blok küçültmesi gerekiyor ki oraya sığsın. karakter sayısını küçültmek resimleri küçültmek anlamına gelmiyor malesef.

Offline grafitus

  • Board Moderators
  • *
  • Posts: 1554
  • Gender: Male
  • just looking for own old energy
  • SMF Version: None
  • SP Version: None
Re: [Blok]Rastgele Konu
« Reply #7 on: March 26, 2010, 03:04:36 PM »
Gelmiyor zaten, resimler yok olmuş oluyordu. Neyse, aşağıdaki şlemi yapın (Deneme fırsatım yoktu).
Kodda;
Code: (Bulun) [Select]
mysql_free_result($request);
Code: (Değiştirin) [Select]
mysql_free_result($request);
$return['body'] = preg_replace('~<img\s+src="([^"]+)"([^/>]+)/>~i', '<img src="$1"$2width="75px" />', $return['body']);
my modsI don't reply support PMs. Please use support forums.

Offline kral

  • Semi Newbie
  • *
  • Posts: 25
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: [Blok]Rastgele Konu
« Reply #8 on: March 26, 2010, 04:03:39 PM »
değişiklik yok aynı. Ayrıca verdiğin koddan 2 tane var ikisine de uyguladım olmadı. konulardaki resimler olduğu gibi çıkıyor.

Offline grafitus

  • Board Moderators
  • *
  • Posts: 1554
  • Gender: Male
  • just looking for own old energy
  • SMF Version: None
  • SP Version: None
Re: [Blok]Rastgele Konu
« Reply #9 on: April 09, 2010, 11:43:49 AM »
Kod SMF 1.1.x serisi için...
my modsI don't reply support PMs. Please use support forums.

Offline mutluokul

  • Newbie
  • Posts: 3
  • SMF Version: 1.1.12
  • SP Version: 2.3.3
Re: [Blok]Rastgele Konu
« Reply #10 on: October 17, 2011, 03:08:09 AM »
smf 2.0.1 için olanı çıkacak mı? kullanan arkadaş varsa paylaşabilr mi? teşekkürler.