Konu: Kayan resim kodları  (Okunma sayısı 2230 defa)

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

19 Kasım 2011, 21:43
  • *
    • İleti: 2018
    • Karma: 41
    • Spina Bifida
    • Profili Görüntüle

Kod: [Seç]
global $smcFunc, $scripturl;

$topic_ids = array(17, 6, 12, 9);

$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_topic IN ({array_int:topics})
ORDER BY m.subject',
array(
'topics' => $topic_ids,
)
);
$topics = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$topics[] = array(
'id_topic' => $row['id_topic'],
'subject' => $row['subject'],
'body' => $row['body'],
'first_image' => preg_match_all('~\[img\]([^\]]+)\[\/img\]~i', $row['body'], $images) ? '<img src="' . $images[1][0] . '" alt="' . $row['subject'] . '" height="250" width="100" />' : '',
);
$smcFunc['db_free_result']($request);

echo '
<table>
<tr>
<td><input type="button" value="«" onclick="document.getElementById(\'images_marquee\').direction = \'left\';" /></td>
<td width="100%">
<marquee id="images_marquee" behavior="scroll" direction="left" scrollamount="8"  height="245" width="100%" onmouseover="this.stop();" onmouseout="this.start();">
<table>
<tr>';
foreach ($topics as $topic)
echo '
<td>
<a href="', $scripturl, '?topic=', $topic['id_topic'], '.0">', $topic['first_image'], '<br /><span>', $topic['subject'], '</span></a>
</td>';
echo '
</tr>
</table>
</marquee>
</td>
<td><input type="button" value="»" onclick="document.getElementById(\'images_marquee\').direction = \'right\';" /></td>
</tr>
</table>';

konu adsız:
Kod: [Seç]
global $smcFunc, $scripturl;

$topic_ids = array(1, 2, 3, 4);

$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_topic IN ({array_int:topics})
ORDER BY m.subject',
array(
'topics' => $topic_ids,
)
);
$topics = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$topics[] = array(
'id_topic' => $row['id_topic'],
'subject' => $row['subject'],
'body' => $row['body'],
'first_image' => preg_match_all('~\[img\]([^\]]+)\[\/img\]~i', $row['body'], $images) ? '<img src="' . $images[1][0] . '" alt="' . $row['subject'] . '" height="100" width="100" />' : '',
);
$smcFunc['db_free_result']($request);

echo '
<table>
<tr>
<td><input type="button" value="«" onclick="document.getElementById(\'images_marquee\').direction = \'left\';" /></td>
<td width="100%">
<marquee id="images_marquee" behavior="scroll" direction="left" scrollamount="8"  height="100" width="100%" onmouseover="this.stop();" onmouseout="this.start();">
<table>
<tr>';
foreach ($topics as $topic)
echo '
<td>
<a href="', $scripturl, '?topic=', $topic['id_topic'], '.0">', $topic['first_image'], '<br /><span></span></a>
</td>';
echo '
</tr>
</table>
</marquee>
</td>
<td><input type="button" value="»" onclick="document.getElementById(\'images_marquee\').direction = \'right\';" /></td>
</tr>
</table>';

konu adlı kod:
Kod: [Seç]
global $smcFunc, $scripturl;

$boards = array(1,2,3);

$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 m.subject',
   array(
      'boards' => $boards,
   )
);
$topics = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
   $topics[] = array(
      'id_topic' => $row['id_topic'],
      'subject' => $row['subject'],
      'body' => $row['body'],
      'first_image'  => preg_match_all('~\[img\]([^\]]+)\[\/img\]~i', $row['body'],  $images) ? '<img src="' . $images[1][0] . '" alt="' .  $row['subject'] . '" height="120" width="70" />' : '',
   );
$smcFunc['db_free_result']($request);

echo '
         <table>
            <tr>
               <td><input  type="button" value="«"  onclick="document.getElementById(\'images_marquee\').direction =  \'left\';" /></td>
               <td width="100%">
                  <marquee  id="images_marquee" behavior="scroll" direction="left"  scrollamount="8"  height="145" width="100%" onmouseover="this.stop();"  onmouseout="this.start();">
                  <table>
                     <tr>';
foreach ($topics as $topic)
   echo '
                        <td>
                           <a  href="', $scripturl, '?topic=', $topic['id_topic'], '.0">',  $topic['first_image'], '<br /><span>', $topic['subject'],  '</span></a>
                        </td>';
echo '
                        </tr>
                     </table>
                  </marquee>
               </td>
               <td><input  type="button" value="»"  onclick="document.getElementById(\'images_marquee\').direction =  \'right\';" /></td>
            </tr>
         </table>';

« Son Düzenleme: 20 Nisan 2014, 14:15 Gönderen: bolubeyi »

30 Mayıs 2013, 23:53
Yanıtla #1
  • *
    • İleti: 5
    • Karma: 0
    • forumsak.com
    • Profili Görüntüle

'' Değerli hocam. öncelikle sitenizin hayırlı olmasını ve başarıların daimini dilerim..

Soruma gelince:

portalda, en son eklenen resimlerde gösterilebilir mi ? zirâ sadece iki konun resmi dışında resim göstermiyor bende..! hem böylelikle rsimli son konular dahil..resimli cevaplar da eklenmiş olur.. ''

ben aşağıdaki kodları kullanıyorum..
Kod: [Seç]
global $smcFunc, $scripturl;

$boards = array(4.0);

$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 m.poster_time DESC
    LIMIT {int:limit}',
    array(
        'boards' => $boards,
        'limit' => 20,
    )
);
$topics = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
    $topics[] = array(
        'id_topic' => $row['id_topic'],
        'subject' => $row['subject'],
        'body' => $row['body'],
        'first_image' => preg_match_all('~\[img\]([^\]]+)\[\/img\]~i', $row['body'], $images) ? '<img src="' . $images[1][0] . '" title="' . $row['subject'] . '" height="140" width="115" />' : '',
    );
$smcFunc['db_free_result']($request);

echo '
            <table>
                <tr>
                    <td><input type="button" value="«" onclick="document.getElementById(\'images_marquee\').direction = \'left\';" /></td>
                    <td width="100%">
                        <marquee id="images_marquee" behavior="scroll" direction="left" scrollamount="8"  height="145" width="100%" onmouseover="this.stop();" onmouseout="this.start();">
                        <table>
                            <tr>';
foreach ($topics as $topic)
    echo '
                                <td>
                                    <a href="', $scripturl, '?topic=', $topic['id_topic'], '.0" >', $topic['first_image'],  '</a>
                                </td>';
echo '
                                </tr>
                            </table>
                        </marquee>
                    </td>
                    <td><input type="button" value="»" onclick="document.getElementById(\'images_marquee\').direction = \'right\';" /></td>
                </tr>
            </table>';


05 Aralık 2014, 23:29
Yanıtla #2
  • *
    • İleti: 110
    • Karma: 0
    • www.turku-fm.com
    • Profili Görüntüle

PHP blok oluşturup kaydedince veyahut var olan bir PHP bloğu editlediğim de  "Veritabanı hatası. Kodlarınızdaki veritabanı sorgularını kontrol edin."  hata mesajını alıyorum.Bu sorunu nasıl haledebilirim.Teşekkürler.

« Son Düzenleme: 06 Aralık 2014, 00:16 Gönderen: Türkü »

06 Aralık 2014, 07:40
Yanıtla #3
  • *
    • İleti: 2018
    • Karma: 41
    • Spina Bifida
    • Profili Görüntüle

sp ayarlarından PHP kodu doğrulamasını kapatın.