News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

SMf - MKPORTAL Son Konular

Started by akorkut, July 14, 2008, 10:12:11 AM

Previous topic - Next topic

akorkut

Herkese kolay gelsin.

SMF (1.1.5)  Forum ve mkportal kurdum.

MKPORTAL ana sayfasında forumdaki son konuları gösteren, daha önceden hazırlanmış  bir blok ekledim.

Bu blokta forumda en son mesaj yazılan başlıkları listeliyor. Sayısı artırılıp azaltabiliyor.

Sitemizin ana sayfasında son 20 -25  mesaj yazılan konuyu yayınlamak istiyoruz, ancak site aşağıya uzayıp gidiyor.

Bizim isteğimiz ise, belli bir pencere içerisinde, bu bloktaki verileri yukarı doğru kayan yazı haline getirmemiz, mouse üstüne gelince durması ve tıklayınca şu andaki işlevin aynısını yerine getirmesi. Ben biraz denedim ama başaramadım.

Not : Bunu mkportalın kendi istesinde yazdık ama henüz bir cevap alamadık.

Saygılar.



Quote<?php
/*-------------------------------------------------------------------------
|  MKPortal SMF Last Posts Table 1.0 (for center block) 16.05.2006
|  for MKP M1.x x SMF 1.x
|  by visiblesoul <visiblesoul.net>
|  Support: http://www.visiblesoul.net/resources/forum/viewforum.php?id=52
+--------------------------------------------------------------------------

Want to show your appreciation for this block?
Link to me on your website using the link code below:

Get free <a href="http://www.visiblesoul.net/" target="_blank">MKPortal modules, blocks, hacks, and skins</a> at <a href="http://www.visiblesoul.net/" target="_blank">Visible Soul Web Design - Corpus Christi, Texas</a>!

---------------------------------------------------------------------------
Config:
--------------------------------------------------------------------------*/
$limit =50;          // Number of forum posts to show in block
$cuttitle = 49;       // Number of characters to display in title
$startformat = "normal";    // Formats the topic start date.
            // Options are 'short', 'time', 'small', 'normal', or leave blank for default.
$lastformat = "short";       // Formats the last post date.
            // Options are 'short', 'time', 'small', 'normal', or leave blank for default.
$showprev = 0;         // Show post preview? Yes=1 No=0
$cutpost = "199";      // Number of characters to display in post preview
/*------------------------------------------------------------------------*/

global $mklib, $mkportals, $db_prefix, $user_info, $modSettings;

$content = "
<tr>
  <td>

    <table class=\"moduleborder\" cellspacing=\"10\" width=\"100%\">
      <tr>
   <th class=\"modulex\" width=\"45%\" style=\"padding-left: 10px;\">Başlık</th>
   <th class=\"modulex\" width=\"20%\" style=\"padding-left: 10px;\">Son Cevap</th>
   <th class=\"modulex\" width=\"25%\" style=\"padding-left: 10px;\">Tarih</th>
   <th class=\"modulex\" width=\"5%\" style=\"text-align: center;\">Okunma</th>
   <th class=\"modulex\" width=\"5%\">Cevap</th>
      </tr>

";

   $db_prefix = DBPREFIX;

        $sql = "
   SELECT
   m.posterTime AS lastPosterTime, m.ID_TOPIC, m.ID_MSG, m.ID_MEMBER, m.smileysEnabled,
   m2.ID_MEMBER AS ID_FIRST_MEMBER, m2.subject, m2.posterTime, m2.body,
   t.ID_BOARD, t.ID_LAST_MSG, t.numReplies, t.numViews, b.name AS bName,   
   IFNULL(mem2.realName, m2.posterName) AS posterName, t.ID_FIRST_MSG,
   IFNULL(mem.realName, m.posterName) AS lastPosterName, t.ID_LAST_MSG
   FROM ({$db_prefix}messages AS m, {$db_prefix}messages AS m2, {$db_prefix}topics AS t, {$db_prefix}boards AS b)
      LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)   
      LEFT JOIN {$db_prefix}members AS mem2 ON (mem2.ID_MEMBER = m2.ID_MEMBER)
   WHERE m2.ID_MSG = t.ID_FIRST_MSG
      AND m.ID_MSG = t.ID_LAST_MSG
      AND t.ID_TOPIC = m.ID_TOPIC
      AND m.ID_MSG >= " . max(0, $modSettings['maxMsgID'] - 20 * $limit) . "
      AND b.ID_BOARD = t.ID_BOARD" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? "
      AND b.ID_BOARD != $modSettings[recycle_board]" : '') . "
      AND $user_info[query_see_board]
   GROUP BY m.ID_TOPIC
   ORDER BY t.ID_LAST_MSG DESC
   LIMIT $limit";

        $DB->query($sql);   

        while ( $post = $DB->fetch_row() ) {
             $title = strip_tags($post['subject']);
           $title = str_replace( "&#33;" , "!" ,$title );
           $title = str_replace( "&quot;", "\"", $title );
               if (strlen($title) > $cuttitle) {
                   $title = substr( $title,0,($cuttitle - 3) ) . "...";
                   $title = preg_replace( '/&(#(\d+;?)?)?(\.\.\.)?$/', '...',$title );
      }

      $starter = $post['posterName'];
      $lastname = $post['lastPosterName'];
      $lastid = $post['ID_MEMBER'];
      $last_postid = $post['ID_LAST_MSG'];
      $posts = $post['numReplies'];
      $views = $post['numViews'];
      $tid = $post['ID_TOPIC'];
      $title = $post['subject'];
      $prepost = $post['body'];

      $prepost = strip_tags($post['body']);
           $prepost = str_replace( "&#33;" , "!" , $prepost );
           $prepost = str_replace( "&quot;", "\"", $prepost );
               if (strlen($prepost) > $cutpost) {
                   $prepost = substr( $prepost,0,($cutpost - 3) ) . "...";
                   $prepost = preg_replace( '/&(#(\d+;?)?)?(\.\.\.)?$/', '...',$prepost );
      }
      
      $startdate  = $mklib->create_date($post['posterTime'],$startformat);      
      $lastdate  = $mklib->create_date($post['lastPosterTime'], $lastformat);

      if ($showprev == 1) {
         $preview = "<tr><td style=\"padding: 2px 20px\" class=\"modulecell\" colspan=\"5\">$prepost</td></tr>";
      }
      else
         $preview = "";

      $content .= "
<!-- topic begin -->

      <tr>

   <td class=\"modulecell\" style=\"padding-left: 10px; text-align: left;\">
     <a style=\"text-decoration: none; font-weight: bold;\" href=\"{$mkportals->forum_url}/index.php?topic={$tid}\" title=\"Konu $starter tarafından $startdate tarihinde açıldı\">$title</a>
   </td>
   <td class=\"modulecell\" style=\"padding-left: 10px; text-align: left;\">
     <a href=\"{$mkportals->forum_url}/index.php?action=profile;u={$lastid}\" title=\"Son Cevap Gönderen: $lastname\"><b>$lastname</b></a>
   </td>

   <td class=\"modulecell\" style=\"padding-left: 10px; text-align: left;\"> $lastdate  </td>
   <td class=\"modulecell\" style=\"padding-right: 10px; text-align: right;\">$views</td>
   <td class=\"modulecell\" style=\"padding-right: 10px; text-align: right;\">$posts</td>             
   </td>
   </tr>

   $preview

<!-- topic end -->   
      ";
}

$content .= "
    </table>

  </td>
</tr>
";

        unset($limit);
   unset($cuttitle);
   unset($startformat);
   unset($lastformat);
   unset($showprev);
   unset($cutpost);
        unset($post);
   unset($tid);
        unset($title);
        unset($views);
   unset($posts);
   unset($startdate);
   unset($starter);
   unset($last_postid);
   unset($sql);
   unset($lastname);
   unset($lastid);
   unset($prepost);
   unset($lastdate);
   unset($preview);
   unset($prepost);

?>


birvarbiryok


hukuk (judge)

#2
Öncelikle  "SSI.php"  dosyasının yedeğini alın;

Bu kodu bulun

Kod:

// Show the top poster's name and profile link.

hemen üstündeki

Kod:
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>';
}


kısımla aşağıdaki kısmı değiştirin

Kod:
echo '

<table  class="windowbg2" cellspacing="1" width="100%" cellpadding="0"  border="0">
<tr>
<th class="windowbg" align="left" width="40%">Konu</th>
<th class="windowbg" align="left" width="25%">Bölüm</th>
<th class="windowbg" align="left" width="12%">Gönderen</th>
<th class="windowbg" align="left" width="16%">Tarih</th>
</tr></table>';
echo '
<MARQUEE onmouseover=this.stop()
                                onmouseout=this.start() scrollAmount=2
                                direction=up height=200><table border="0" class="ssi_table">';
foreach ($posts as $post)




echo '

<tr>
<td class="windowbg" valign="middle" width="43%">', $post['link'], '</td> <td class="windowbg" valign="middle" width="27%">', $post['board']['link'], '</td>
    <td class="windowbg" valign="middle" width="12%">', $post['poster']['link'], '</td>
<td class="windowbg" valign="middle" width=18%">', $post['time'], '</td>

</tr>';
echo '
</table></MARQUEE>';
}



Sonra yeni bir PHP blok oluşturup yazanları silip


Kod:
<?php

$content
=implode(""file("http://www.siteadı.com/forum/SSI.php?ssi_function=recentTopics"));

?>


bu kodu ekleyip bloğu aktifleştirin...

MKPortal 1.1 + SMF 1.1 RC2  'de denenmiştir...

Not : Alıntıdır...

Smfdeki son konuları bu şekle getirmek içinse :
http://www.simplemachines.org/community/index.php?topic=257280.0

akorkut

Teşekkür ederim.
Ancak şunu anlayamadım. Daha önceki verdiğim kodlarda mesaj yazılan başıkların tamamını görebiliyordum. Bu kodları uyguladığım zaman ise en son konu yazılan bir kaç başlığı göremiyorum.
Galiba üye izinleri ile alakalı bir konu.
Aklım durdu onu nerden izin vereceğimi bulamıyorum.

Advertisement: