Advertisement:

Author Topic: Yet another SSI question...  (Read 2863 times)

Offline tecsbrain

  • Newbie
  • *
  • Posts: 3
Yet another SSI question...
« on: July 27, 2008, 10:19:21 PM »
I would like to search for the answer to this but I don't know how to phrase it.  I have the following code included in my website:

Code: [Select]
<?php
$exclude 
= array('1','2','3','4','5','6','7','8','9','10','11','12','13','15','16','17','18');
$topics ssi_recentTopics(10$exclude'array');

   
$array ssi_boardNews(14.05null250'array');

   foreach (
$array as $news)
   {
      echo 
'
         <table border="0" width="100%" align="center" style="font-family:Arial, Verdana, Tahoma, sans-serif; font-size:10pt;">
            <tr>
               <td bgcolor="#DDDDDD"><b>'
$news['subject'], '</b></td>
            </tr>
            <tr>
               <td>'
$news['body'], '<br /></td>
            </tr>
         </table>
         '
;

 
/*     if (!$news['is_last'])
         echo '
         <hr width="100%" />
         ';*/
   
}


///foreach($topics as $topic)
///  echo $topic['subject'], '<br />';
 
?>

..with all the necessary PHP includes and start and end tags, etc.  It works great!

But I'd like to change the title to be a link to the thread as well, instead of just the title in plain text.  I copied the following from line 396 of SSI.php:

Code: [Select]
<a href="' . $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#new">' . $row['subject'] . '</a>
It doesn't return any errors but the only variable that is replaced is $scripturl -- nothing else is included in the URL.  I know I am doing something wrong, but I am at PHP/MySQL Level 1.5 and don't know what to do...any help is appreciated.

Offline lordtron

  • Sophist Member
  • *****
  • Posts: 1,247
  • Gender: Male
    • VainSoft
Re: Yet another SSI question...
« Reply #1 on: July 27, 2008, 10:54:22 PM »
Alright here you go. This works, I tested it out on my site.

To see it in the works, click here

Code: [Select]
<?php
// Connects to your Database
$exclude = array('1','2','3','4','5','6','7','8','9','10','11','12','13','15','16','17','18');
$topics ssi_recentTopics(10$exclude'array');


   
$array ssi_boardNews(14.05null250'array');

   foreach (
$array as $news)
   {
      echo 
'
         <table border="0" width="100%" align="center" style="font-family:Arial, Verdana, Tahoma, sans-serif; font-size:10pt;">
            <tr>
               <td bgcolor="#DDDDDD"><b><a href="'
$news['href']. '">'$news['subject'], '</a></b></td>
            </tr>
            <tr>
               <td>'
$news['body'], '<br /></td>
            </tr>
         </table>
         '
;

 
/*     if (!$news['is_last'])
         echo '
         <hr width="100%" />
         ';*/
   
}


///foreach($topics as $topic)
///  echo $topic['subject'], '<br />';
 
?>


« Last Edit: July 27, 2008, 11:11:16 PM by lordtron »

VainSoftGames.com - New Design To Gaming

Offline ccbtimewiz

  • SMF Hero
  • ******
  • Posts: 5,300
  • Gender: Male
  • OXEN
Re: Yet another SSI question...
« Reply #2 on: July 28, 2008, 12:31:35 AM »
I've cleaned it up a bit, if you wish for it.

Code: [Select]
<?php
# Connections
$exclude = array('1','2','3','4','5','6','7','8','9','10','11','12','13','15','16','17','18');
$topics ssi_recentTopics(10$exclude'array');
$array ssi_boardNews(14.05null250'array');

   foreach (
$array as $news)
   {
      echo 
'
         <table border="0" width="100%" align="center" style="font-family: Arial, Verdana, Tahoma, sans-serif; font-size: 10pt;">
            <tr>
               <td style="background-color: #dddddd;"><strong><a href="'
$news['href']. '" target="_self">'$news['subject'], '</a></strong</td>
            </tr>
            <tr>
               <td>'
$news['body'], '<br /></td>
            </tr>
         </table>
         '
; }
 
?>

« Last Edit: July 28, 2008, 01:38:23 AM by ccbtimewiz »

Offline lordtron

  • Sophist Member
  • *****
  • Posts: 1,247
  • Gender: Male
    • VainSoft
Re: Yet another SSI question...
« Reply #3 on: July 28, 2008, 12:39:57 AM »
Did you ever think that maybe he might have other code in that and he should us only what he wanted us to see. Plus maybe he needed those Commented areas in there for later use.
He never asked for the code to be cleaned or anything, just for us to find out how to get it working.

VainSoftGames.com - New Design To Gaming

Offline ccbtimewiz

  • SMF Hero
  • ******
  • Posts: 5,300
  • Gender: Male
  • OXEN
Re: Yet another SSI question...
« Reply #4 on: July 28, 2008, 12:42:28 AM »
The less code, the faster performance. Also, I fixed a couple (x)HTML errors and spaced it a bit better. The way it was coded would have resulted in some (x)HTML problems.

If he wanted to keep the commented code in it, he obviously still has the code he used in the first post. ^^;

Offline lordtron

  • Sophist Member
  • *****
  • Posts: 1,247
  • Gender: Male
    • VainSoft
Re: Yet another SSI question...
« Reply #5 on: July 28, 2008, 12:49:25 AM »
There where no HTML errors in the code.

And I tested the code in Firefox, Safari, IE, Opera and no problems what so ever in any of them.
And plus if he took out the Comments, my code would be less code, so mine would load faster than yours then.

VainSoftGames.com - New Design To Gaming

Offline ccbtimewiz

  • SMF Hero
  • ******
  • Posts: 5,300
  • Gender: Male
  • OXEN
Re: Yet another SSI question...
« Reply #6 on: July 28, 2008, 12:56:55 AM »
The "bgcolor" tag is depricated, and hex should be in lowercase at all times. Bold tags should be replaced with strong tags as well.

Not really big problems, but it's how the W3C teaches it.

Regardless, both code suggestions work fine. It's really up to tecsbrain to modify the code to his liking for his website.  I just offered a cleaner method, hence I said "if you wish it". :)
« Last Edit: July 28, 2008, 01:39:21 AM by ccbtimewiz »

Offline tecsbrain

  • Newbie
  • *
  • Posts: 3
Re: Yet another SSI question...
« Reply #7 on: July 28, 2008, 06:59:46 PM »
Thanks gentlemen for your help.  I copied that code from a tutorial around here or in SMF world that included the deprecated tags, though.  If I could remember where it was........

Offline metallica48423

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,842
  • Gender: Male
  • Professional Multislacker!
    • Zentendo
Re: Yet another SSI question...
« Reply #8 on: July 30, 2008, 12:22:47 AM »
guys, theres no need to argue over semantics of the whole ordeal.  you both helped out and thats whats important :)
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

Quote
Microsoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"

Useful Links:
Online Manual!
How to Help us Help you   
Search
Settings Repair Tool