News:

Wondering if this will always be free?  See why free is better.

Main Menu

Scrolling '#include virtual' -- help!

Started by BigMike, November 12, 2003, 04:01:56 PM

Previous topic - Next topic

BigMike

Hey guys,

I've finally exhausted myself and the resources I could find  so Im resorting here hoping someone has this already working on their webpage.

I've modified the SSI function recentTopics() to list the topics in a horizontal one-by-one listing.
I would like to use a Horizontal scrolling applet that can scroll the recent topics across my webpage.

So far I've come across many many applets and java scripts that scroll text just fine but not an include. They use

<PARAM NAME=SCROLLTEXT VALUE="(TEXT TO SCROLL)">

Where (TEXT TO SCROLL) of course is the information that will be scrolling.

But I think its not possible to use <!--#include virtual="SSI.php?function=recentTopics" --> in a <param> style such as:

<PARAM NAME=SCROLLTEXT VALUE="<!--#include virtual="SSI.php?function=recentTopics" -->">

It seems, though, that it works, but it doesn't consider any html coding. It just translates the SSI call directly to text. It does print <table border= and then that's it. I believe this is because it gets to the very first quote " from <table border="0"> and then since the " is a html function it just ends the <param> right then.

I tried sneaking the <!--#include virtual="SSI.php?function=recentTopics" --> into a variable by using javascript but then it just lists the actual variable that I used from the script.

So these applets that I've been using are specifically for text and text translation only. So here's my question: Does anyone know of a horizontal scroller that can display more complex items? Specifically displaying my <!--#include virtual="SSI.php?function=recentTopics" -->   !!!!!!!!

Thanks for the help,
BigMike

bostasp

The function "recentTopics" in SSI.php just echos a table with the data in.

You can fix this and just have it produce text with no table formatting, by opening up SSI.php and looking for the following bit of code:


function recentTopics ()
{
   global $settings, $scripturl, $txt, $censored, $db_prefix, $num_recentTopics, $username, $imagesdir, $ID_MEMBER, $cgi;

   //Limit recent topics to 24 hours. Uncomment the following line for more speed
   //$timeLimit = 24 * 60 * 60;
   $request = mysql_query("
      SELECT m.ID_MSG
      FROM {$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b,{$db_prefix}categories AS c
      WHERE t.ID_TOPIC=m.ID_TOPIC
         AND b.ID_BOARD=t.ID_BOARD
         AND c.ID_CAT=b.ID_CAT
         AND (FIND_IN_SET('$settings[7]', c.memberGroups) != 0 OR c.memberGroups='' OR '$settings[7]' LIKE 'Administrator' OR '$settings[7]' LIKE 'Global Moderator')
         " . ($timeLimit > 0 ? 'AND m.posterTime>' . (time() - $timeLimit) : '') . "
      ORDER BY posterTime DESC
      LIMIT 0, $num_recentTopics;") or database_error(__FILE__, __LINE__);
   $messages = array();
   while ($row = mysql_fetch_array($request))
      $messages[] = $row['ID_MSG'];

   if (count($messages))
   {
      $request = mysql_query("
         SELECT m.posterTime, m.subject, m.ID_TOPIC, m.posterName, m.ID_MEMBER, IFNULL(mem.realName, m.posterName) AS posterDisplayName, t.numReplies, t.ID_BOARD, t.ID_FIRST_MSG, b.name AS bName, IFNULL(lt.logTime, 0) AS isRead, IFNULL(lmr.logTime, 0) AS isMarkedRead
         FROM {$db_prefix}messages AS m, {$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}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=t.ID_BOARD AND lmr.ID_MEMBER=$ID_MEMBER)
         WHERE m.ID_MSG IN (" . implode(',', $messages) . ")
            AND t.ID_TOPIC=m.ID_TOPIC
            AND b.ID_BOARD=t.ID_BOARD
         ORDER BY m.posterTime DESC;") or database_error(__FILE__, __LINE__);

      if (mysql_num_rows($request) > 0)
      {
         $post = '<table border="0">';

         while ($row = mysql_fetch_array($request))
         {
            $new = ($row['isRead'] >= $row['posterTime'] || $row['isMarkedRead'] >= $row['posterTime'] ? false : true);
            if (!$new || $username == 'Guest')
               $new = '';
            else
               $new = '<a href="' . $cgi . $row['ID_BOARD'] . ';action=display;threadid=' . $row['ID_TOPIC'] . ';start=new">' . '<img src="' . $imagesdir . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>';
           
            $post .= '<tr>';

            if ($row['ID_MEMBER'] != -1)
            {
               $euser = urlencode($row['posterName']);
               $dummy = "<a href=\"$scripturl?action=viewprofile;user=$euser\">$row[posterDisplayName]</a>";
            }
            else
               $dummy = $row['posterName'];

            $post .= '
               <td align="right" valign="top" nowrap="nowrap">
                  <font size="2">
                     [<a href="' . $cgi . $row[ID_BOARD] . '">' . $row[bName] . '</a>]
                  </font>
               </td>
               <td valign="top">
                  <font size="2">
                     <a href="' . $cgi . $row[ID_BOARD] . ';action=display;threadid=' . $row[ID_TOPIC] . ';start=' . $row[numReplies] . '">' . $row[subject] . '</a> ' . $txt[525] . ' ' . $dummy . ' ' . $new . '
                  </font>
               </td>
               <td align="right" nowrap="nowrap">
                  <font size="2">
                     ' . timeformat($row['posterTime']) . '
                  </font>
               </td>
            </tr>';
         }
         $post .= '</table>';
      }
      else
         $post = '---';
   }
   else
      $post = '---';

   CensorTxt($post);

   echo $post;

   foreach ($censored as $tmpa => $tmpb)
      $thepost = str_replace($tmpa,$tmpb,$thepost );

   echo $thepost;
}



To get just a single line, replace that with this:


function recentTopics ()
{
   global $settings, $scripturl, $txt, $censored, $db_prefix, $num_recentTopics, $username, $imagesdir, $ID_MEMBER, $cgi;

   //Limit recent topics to 24 hours. Uncomment the following line for more speed
   //$timeLimit = 24 * 60 * 60;
   $request = mysql_query("
      SELECT m.ID_MSG
      FROM {$db_prefix}messages AS m, {$db_prefix}topics AS t, {$db_prefix}boards AS b,{$db_prefix}categories AS c
      WHERE t.ID_TOPIC=m.ID_TOPIC
         AND b.ID_BOARD=t.ID_BOARD
         AND c.ID_CAT=b.ID_CAT
         AND (FIND_IN_SET('$settings[7]', c.memberGroups) != 0 OR c.memberGroups='' OR '$settings[7]' LIKE 'Administrator' OR '$settings[7]' LIKE 'Global Moderator')
         " . ($timeLimit > 0 ? 'AND m.posterTime>' . (time() - $timeLimit) : '') . "
      ORDER BY posterTime DESC
      LIMIT 0, $num_recentTopics;") or database_error(__FILE__, __LINE__);
   $messages = array();
   while ($row = mysql_fetch_array($request))
      $messages[] = $row['ID_MSG'];

   if (count($messages))
   {
      $request = mysql_query("
         SELECT m.posterTime, m.subject, m.ID_TOPIC, m.posterName, m.ID_MEMBER, IFNULL(mem.realName, m.posterName) AS posterDisplayName, t.numReplies, t.ID_BOARD, t.ID_FIRST_MSG, b.name AS bName, IFNULL(lt.logTime, 0) AS isRead, IFNULL(lmr.logTime, 0) AS isMarkedRead
         FROM {$db_prefix}messages AS m, {$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}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=t.ID_BOARD AND lmr.ID_MEMBER=$ID_MEMBER)
         WHERE m.ID_MSG IN (" . implode(',', $messages) . ")
            AND t.ID_TOPIC=m.ID_TOPIC
            AND b.ID_BOARD=t.ID_BOARD
         ORDER BY m.posterTime DESC;") or database_error(__FILE__, __LINE__);

      if (mysql_num_rows($request) > 0)
      {
         $post = '';

         while ($row = mysql_fetch_array($request))
         {
            $new = ($row['isRead'] >= $row['posterTime'] || $row['isMarkedRead'] >= $row['posterTime'] ? false : true);
            if (!$new || $username == 'Guest')
               $new = '';
            else
               $new = '<a href="' . $cgi . $row['ID_BOARD'] . ';action=display;threadid=' . $row['ID_TOPIC'] . ';start=new">' . '<img src="' . $imagesdir . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>';
            
            $post .= '<tr>';

            if ($row['ID_MEMBER'] != -1)
            {
               $euser = urlencode($row['posterName']);
               $dummy = "<a href=\"$scripturl?action=viewprofile;user=$euser\">$row[posterDisplayName]</a>";
            }
            else
               $dummy = $row['posterName'];

            $post .= ' - [<a href="' . $cgi . $row[ID_BOARD] . '">' . $row[bName] . '</a>] <a href="' . $cgi . $row[ID_BOARD] . ';action=display;threadid=' . $row[ID_TOPIC] . ';start=' . $row[numReplies] . '">' . $row[subject] . '</a> ' . $txt[525] . ' ' . $dummy . ' ' . $new . ' '. timeformat($row['posterTime']) .'-  ';
         }
         $post .= '';
      }
      else
         $post = '---';
   }
   else
      $post = '---';

   CensorTxt($post);

   echo $post;

   foreach ($censored as $tmpa => $tmpb)
      $thepost = str_replace($tmpa,$tmpb,$thepost );

   echo $thepost;
}


Remember to backup your SSI.php before you do all that  :)

Advertisement: