SimplePortal
Support => Turkish (Türkçe) => International Support => Ki?iselle?tirme => Topic started by: Paragaya on February 22, 2009, 04:55:15 AM
-
A?a??daki kodu bir php blok a kaydederseniz rastgele bir konu görüntüler :)
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>';
}
-
tesekkurler hos paylasim
-
önemli deil.
-
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 :(
-
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.
-
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 $length= 300; ifadesinideki 300 karakter sınırını düşürün.
-
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.
-
Gelmiyor zaten, resimler yok olmuş oluyordu. Neyse, aşağıdaki şlemi yapın (Deneme fırsatım yoktu).
Kodda;
mysql_free_result($request);
mysql_free_result($request);
$return['body'] = preg_replace('~<img\s+src="([^"]+)"([^/>]+)/>~i', '<img src="$1"$2width="75px" />', $return['body']);
-
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.
-
Kod SMF 1.1.x serisi için...
-
smf 2.0.1 için olanı çıkacak mı? kullanan arkadaş varsa paylaşabilr mi? teşekkürler.