News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

ssi functions on top of joomla

Started by samozin, June 15, 2007, 06:58:14 PM

Previous topic - Next topic

samozin

hey evey one  i was wondering if can do something like this
http://www.fun-db.com


by using joomla with my smf forum

i made simple component that one contains the ssi function s codes

Quote<?php




            
      

function recentTopicMarquee($num_recent = 20, $exclude_boards = null, $output_method = 'echo')
{
        global $context, $settings, $scripturl, $txt, $db_prefix, $ID_MEMBER, $user_info, $modSettings;

        if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
                $exclude_boards = array($modSettings['recycle_board']);
        else
                $exclude_boards = empty($exclude_boards) ? array() : $exclude_boards;

        $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 all the posts in distinct topics.  Newer ones will have higher IDs.
        $request = db_query("
                SELECT
                        m.posterTime, ms.subject, m.ID_TOPIC, m.ID_MEMBER, m.ID_MSG, b.ID_BOARD, b.name AS bName,  t.numReplies AS tNumReplies,t.numViews As tNumViews,
                        IFNULL(mem.realName, m.posterName) AS posterName, " . ($user_info['is_guest'] ? '1 AS isRead, 0 AS new_from' : '
                        IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, 0)) >= m.ID_MSG_MODIFIED AS isRead,
                        IFNULL(lt.ID_MSG, IFNULL(lmr.ID_MSG, -1)) + 1 AS new_from') . ", LEFT(m.body, 384) AS body, m.smileysEnabled, m.icon
                FROM ({$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b, {$db_prefix}messages AS ms)
                        LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)" . (!$user_info['is_guest'] ? "
                        LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
                        LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = b.ID_BOARD AND lmr.ID_MEMBER = $ID_MEMBER)" : '') . "
                WHERE t.ID_LAST_MSG >= " . ($modSettings['maxMsgID'] - 35 * min($num_recent, 5)) . "
                        AND t.ID_LAST_MSG = m.ID_MSG
                        AND b.ID_BOARD = t.ID_BOARD" . (empty($exclude_boards) ? '' : "
                        AND b.ID_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . "
                        AND $user_info[query_see_board]
                        AND ms.ID_MSG = t.ID_FIRST_MSG
                ORDER BY t.ID_LAST_MSG DESC
                LIMIT $num_recent", __FILE__, __LINE__);
        $posts = array();
        while ($row = mysql_fetch_assoc($request))
        {
                $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']), array('<br />' => '')));
                if (strlen($row['body']) > 128)
                        $row['body'] = substr($row['body'], 0, 128) . '...';

                // Censor the subject.
                censorText($row['subject']);
                censorText($row['body']);

                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';

                // Build the array.    all elements if you want to change in the display
                $posts[] = array(
                        'board' => array(
                                'id' => $row['ID_BOARD'],
                                'name' => $row['bName'],
                                'href' => $scripturl . '?board=' . $row['ID_BOARD'] . '.0',
                                'link' => '<a href="' . $scripturl . '?board=' . $row['ID_BOARD'] . '.0">' . $row['bName'] . '</a>'
                        ),
                        'topic' => $row['ID_TOPIC'],
                        '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']) ? $row['posterName'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['posterName'] . '</a>'
                        ),
                        'tNumReplies'=> $row['tNumReplies'],
                        'tNumViews'=> $row['tNumViews'],
                        'subject' => $row['subject'],
                        'short_subject' => shorten_subject($row['subject'], 25),
                        'preview' => $row['body'],
                        'time' => timeformat($row['posterTime']),
                        'timestamp' => forum_time(true, $row['posterTime']),
                        'href' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . ';topicseen#new',
                        'link' => '<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#new">' . $row['subject'] . '</a>',
                        'new' => !empty($row['isRead']),
                        'new_from' => $row['new_from'],
                        'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
                );
        }
        mysql_free_result($request);

        // Just return it.
        if ($output_method != 'echo' || empty($posts))
                return $posts;

        echo '<font face=verdana size=2><marquee onmouseover=this.stop() onmouseout=this.start() scrollAmount=2 scrollDelay=1 direction=',$context["right_to_left"]? "right":"left",' height="30"><b><font color="#CC3300" ><p align="center">',$context["right_to_left"]? "آخر مواضيع المنتدى":"Latest Topics",' : ';

        foreach ($posts as $post)
         echo'<a title="',$context["right_to_left"]? "شوهد الموضوع ":"Topic views ",'',$post['tNumViews'],' ',$context["right_to_left"]? "مرة":"Times",'" href="',$post['href'],'" style="text-decoration: none"> ~::~   ',$post['subject'],'<font size=1>    </font></a><font color="#CC3300">&nbsp;',$context["right_to_left"]? "ردود":"replies",' (',$post['tNumReplies'],')</font>';

        echo '
                </marquee></font>';
}




// شريط أخر المواضيع من samozin www.softolive.com


      echo '

<table border="0" width="100%" cellspacing="' , ($context['browser']['is_ie'] || $context['browser']['is_opera6']) ? '1' : '0' , '" cellpadding="1">
   
   <tr>
      <td class="titlebg" width="90"  valign="right" align="right" >
      <div class="normaltext">
         أخر المشاركات
         </div>
      </td>
      <td class="naw" cellpadding="0" >';

      recentTopicMarquee();
      
                  
      
      echo '
      
</table>
';


//////////////////////////////


















echo '


<body aLink=#ff0000 background="" bgColor=#ffffff link=#0000ff text=#000000
vLink=#800080 dir=rtl>
<P align=center></P>





<div align="right">
                  
                            </div>';








echo '
   <div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'style="width: 100%;"' : '', '>
   <table border="0" width="100%" cellspacing="0" cellpadding="2" class="bordercolor">  <tr>
   <td width="100%" align="right" class="catbg" height="24">
   <font color="#FFFFFF"><b>!! Haftanin Uyesi !!</b></font></td>
  </tr><tr><td width="100%" colspan="4" class="titlebg" height="12" align="right"></td></tr>
<tr class="windowbg2">
      <td><br>
<p align="right"><b><font color="#FF0000">'; ssi_boardNews();
echo '</font>
</b></p>

<BR /></p>
      </td>
   </tr>
</table></div><br>

   ';


echo '
   <div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'style="width: 100%;"' : '', '>
   <table border="0" width="100%" cellspacing="0" cellpadding="2" class="bordercolor">  <tr>
   <td width="100%" align="right" class="catbg" height="24">
   <font color="#FFFFFF"><b>!! أحــدث الرســائل !!</b></font></td>
  </tr><tr><td width="100%" colspan="4" class="titlebg" height="12" align="right"></td></tr>
<tr class="windowbg2">
      <td><br>
<p align="right"><b><font color="#FF0000">'; ssi_recentTopics();
echo '</font>
</b></p>

<BR /></p>
      </td>
   </tr>
</table></div><br>

   ';






echo '

   <table border="0" width="100%" class="tborder" cellspacing="' , ($context['browser']['is_ie'] || $context['browser']['is_opera6']) ? '1' : '0' , '" cellpadding="2" style="margin-bottom: 2ex;">
      <tr>
         <td class="catbg"><span class="smalltext">Toplist</td>
      </tr>
      <tr>
         <td valign="middle" align="center" height="60">
            <a href="http://www.forumklas.org/" target="_blank">
               ForumKlas
            </a>

         </td>
      </tr>
   </table>';








?>



this in really nice
but 
still having aprob with
big pics in the posts that makes the page looks  bad
so i suggested to change the maximum hight and with of the shown pics in the smf  but thatwill change the whole pix on the forum   and i dont want that ... sometimes works and somtime not working so

could
any one  add any code that resizes the images in  inside the ssi functions
to fit the needed width  on joomla

Advertisement: