Advertisement:

Author Topic: Advanced SSI FAQ  (Read 200551 times)

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,142
  • Gender: Male
Re: Advanced SSI FAQ
« Reply #20 on: July 03, 2004, 12:58:33 AM »
Code: [Select]
$posts = ssi_recentPosts(25, array(), 'array');
$name = 'MsHoney';

foreach ($posts as $post)
{
echo '
<table border="0" width="100%" align="center">
<tr>
<td><b>', $post['poster']['link'], '</b></td>
</tr>
<tr>
<td>', $post['subject'], '<br /><br /></td>
</tr>
</table>
<br />';

if ($post['poster']['name'] == $name)
echo $row['poster']['link'];
}

Don't use Lamper's ugly formatting it makes it harder :P.

-[Unknown]

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: Advanced SSI FAQ
« Reply #21 on: July 03, 2004, 01:52:14 AM »
Code: [Select]
$posts = ssi_recentPosts(25, array(), 'array');
$name = 'MsHoney';

foreach ($posts as $post)
{
echo '
<table border="0" width="100%" align="center">
<tr>
<td><b>', $post['poster']['link'], '</b></td>
</tr>
<tr>
<td>', $post['subject'], '<br /><br /></td>
</tr>
</table>
<br />';

if ($post['poster']['name'] == $name)
echo $row['poster']['link'];
}

Don't use Lamper's ugly formatting it makes it harder :P.

-[Unknown]

lol.

thanks for the help, I ran the script but I'm still having problems. Other recent topics from other posters are being displayed. It seems that the $post variable is overriding the $name variable.

What I was trying to do was to display only recent topics by the poster MsHoney.  Is what I'm trying to do even possible?
here's my ssi test link:
http://blaqboard.com/testportal.php

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,142
  • Gender: Male
Re: Advanced SSI FAQ
« Reply #22 on: July 03, 2004, 01:58:07 AM »
Try:

echo '<pre>Name: ', $name, '<br />';
print_r($post);
echo ''</pre>;

Inside the loop...

-[Unknown]

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: Advanced SSI FAQ
« Reply #23 on: July 03, 2004, 02:13:02 AM »
Try:

echo '<pre>Name: ', $name, '<br />';
print_r($post);
echo ''</pre>;

Inside the loop...

-[Unknown]

This is what I have so far:
Code: [Select]
$posts = ssi_recentPosts(8, array(), 'array');
$name = 'MsHoney';



foreach ($posts as $post)
echo '<pre>Name: ', $name, '<br />';
print_r($post);
echo '</pre>';

{
 

      echo '
               <table border="0" width="100%" align="center">
                     <tr>
                                <td><b>', $post['poster']['link'], '</b></td>
                      </tr>
                        <tr>
                                <td>', $post['subject'], '<br /><br /></td>
                    </tr>
                </table>
                <br />';

       if ($post['poster']['name'] == $name)
             echo $row['poster']['link'];
}

and this is what is displayed:

Name: MsHoney
Name: MsHoney
Name: MsHoney
Name: MsHoney
Name: MsHoney
Name: MsHoney
Name: MsHoney
Name: MsHoney
Array
(
    [board] => Array
        (
            [id] => 2
            [name] => The BlaqBoard Jungle
            [href] => http://www.blaqboard.com/v2/Diesel/Edition/index.php?board=2.0
            [link] => The BlaqBoard Jungle
        )

    [topic] => 21640
    [poster] => Array
        (
            [id] => 97
            [name] => MsHoney
            [href] => http://www.blaqboard.com/v2/Diesel/Edition/index.php?action=profile;u=97
            [link] => MsHoney
        )

    [subject] => Shyne's New Website
    [short_subject] => Shyne's New Website
    [time] => Today at 08:20:48pm
    [timestamp] => 1088824776
    [href] => http://www.blaqboard.com/v2/Diesel/Edition/index.php?topic=21640.msg361538;topicseen#msg361538
    [link] => Shyne's New Website
    [new] => 1
    [newtime] => 0
)


               

MsHoney

Shyne's New Website



http://blaqboard.com/testportal.php

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,142
  • Gender: Male
Re: Advanced SSI FAQ
« Reply #24 on: July 03, 2004, 02:18:35 AM »
No, no, like this:

Code: [Select]
foreach ($posts as $post)
{

echo '<pre>Name: ', $name, '<br />';
print_r($post);
echo '</pre>';
 

      echo '
               <table border="0" width="100%" align="center">
                     <tr>
                                <td><b>', $post['poster']['link'], '</b></td>
                      </tr>
                        <tr>
                                <td>', $post['subject'], '<br /><br /></td>
                    </tr>
                </table>
                <br />';

       if ($post['poster']['name'] == $name)
             echo $row['poster']['link'];
}

Here's a basic rundown:
Quote
foreach ($posts as $post) <-- look at each post.
{ <-- use everything inside these curly braces to look at them.

echo '<pre>Name: ', $name, '<br />';
print_r($post); <-- get everything in the post array.
echo '</pre>';
 

      echo '
               <table border="0" width="100%" align="center">
                     <tr>
                                <td><b>', $post['poster']['link'], '</b></td>
                      </tr>
                        <tr>
                                <td>', $post['subject'], '<br /><br /></td>
                    </tr>
                </table>
                <br />';

       if ($post['poster']['name'] == $name) <-- if this poster's name is the same as the name above output the link.
             echo $row['poster']['link'];
}

-[Unknown]

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: Advanced SSI FAQ
« Reply #25 on: July 03, 2004, 02:50:25 AM »
No, no, like this:

Code: [Select]
foreach ($posts as $post)
{

echo '<pre>Name: ', $name, '<br />';
print_r($post);
echo '</pre>';
 

      echo '
               <table border="0" width="100%" align="center">
                     <tr>
                                <td><b>', $post['poster']['link'], '</b></td>
                      </tr>
                        <tr>
                                <td>', $post['subject'], '<br /><br /></td>
                    </tr>
                </table>
                <br />';

       if ($post['poster']['name'] == $name)
             echo $row['poster']['link'];
}

Here's a basic rundown:
Quote
foreach ($posts as $post) <-- look at each post.
{ <-- use everything inside these curly braces to look at them.

echo '<pre>Name: ', $name, '<br />';
print_r($post); <-- get everything in the post array.
echo '</pre>';
 

      echo '
               <table border="0" width="100%" align="center">
                     <tr>
                                <td><b>', $post['poster']['link'], '</b></td>
                      </tr>
                        <tr>
                                <td>', $post['subject'], '<br /><br /></td>
                    </tr>
                </table>
                <br />';

       if ($post['poster']['name'] == $name) <-- if this poster's name is the same as the name above output the link.
             echo $row['poster']['link'];
}

-[Unknown]

copying and pasting your code:
Code: [Select]
$posts = ssi_recentPosts(5, array(), 'array');
$name = 'MsHoney';

foreach ($posts as $post) //<-- look at each post.
{ //<-- use everything inside these curly braces to look at them.

echo '<pre>Name: ', $name, '<br />';
print_r($post); //<-- get everything in the post array.
echo '</pre>';
 

      echo '
               <table border="0" width="100%" align="center">
                     <tr>
                                <td><b>', $post['poster']['link'], '</b></td>
                      </tr>
                        <tr>
                                <td>', $post['subject'], '<br /><br /></td>
                    </tr>
                </table>
                <br />';

       if ($post['poster']['name'] == $name) //<-- if this posters name is the same as the name above output the link.
             echo $row['poster']['link'];
}

I get similar results as before:
http://blaqboard.com/testportal.php

is the problem coming from this line?
Code: [Select]
$posts = ssi_recentPosts(5, array(), 'array');

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: Advanced SSI FAQ
« Reply #26 on: July 03, 2004, 02:59:05 PM »
This is what I have so far:

Code: [Select]
<?php
require("/***/SSI.php"); 

$posts ssi_recentTopics(2000, array(), &#39;array&#39;);
$id 97;

foreach (
$posts as $post//<-- look at each post.
//<-- use everything inside these curly braces to look at them.
if ($post[&#39;poster&#39;][&#39;id&#39;] == $id)
echo $post[&#39;poster&#39;][&#39;name&#39;] . &#39;<br />&#39; . $post[&#39;time&#39;] . &#39;<br />&#39; . $post[&#39;link&#39;];
echo &#39;<pre>&#39;;
print_r($post null);
echo &
#39;</pre>&#39;;
}
?>

http://blaqboard.com/testportal.php
« Last Edit: July 03, 2004, 04:32:41 PM by Elijah Bliss »

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,142
  • Gender: Male
Re: Advanced SSI FAQ
« Reply #27 on: July 04, 2004, 03:42:44 AM »
Are you looking for all the posts by a specific member?

-[Unknown]

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: Advanced SSI FAQ
« Reply #28 on: July 04, 2004, 10:58:24 AM »
Are you looking for all the posts by a specific member?

-[Unknown]

Yes, I am.

Actually the just the topics. I solved the formatting problem, the only problem I have now is that anytime someone responds to a recent topic of this poster the topic disappears from the test portal page. I don't want to do "ssi_recentPosts" because I am not interested in this poster's responses, only her topics. Is there anyway to keep her topics on the page?

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,142
  • Gender: Male
Re: Advanced SSI FAQ
« Reply #29 on: July 04, 2004, 05:12:18 PM »
You're going through a very round about way... it would be better to just use a specialized SQL query.

$result = db_query("
   SELECT m.ID_TOPIC, m.subject
   FROM {$db_prefix}topics AS t, {$db_prefix}messages AS m
   WHERE t.ID_MEMBER_STARTED = the ID of MsHoney here!
      AND m.ID_MSG = t.ID_FIRST_MSG
   LIMIT how many you want", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result))
{
   echo '<a href="', $scripturl, '?topic=', $row['ID_TOPIC'], '.0">', $row['subject'], '</a><br />';
}
mysql_free_result($result);

-[Unknown]

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: Advanced SSI FAQ
« Reply #30 on: July 04, 2004, 06:10:39 PM »
You're going through a very round about way... it would be better to just use a specialized SQL query.

$result = db_query("
   SELECT m.ID_TOPIC, m.subject
   FROM {$db_prefix}topics AS t, {$db_prefix}messages AS m
   WHERE t.ID_MEMBER_STARTED = the ID of MsHoney here!
      AND m.ID_MSG = t.ID_FIRST_MSG
   LIMIT how many you want", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result))
{
   echo '<a href="', $scripturl, '?topic=', $row['ID_TOPIC'], '.0">', $row['subject'], '</a><br />';
}
mysql_free_result($result);

-[Unknown]

I keep getting this error using the SQL query:
Warning: Cannot modify header information - headers already sent by (output started at /***/Sources/Load.php:812) in /***/Sources/Subs.php on line 1599

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,142
  • Gender: Male
Re: Advanced SSI FAQ
« Reply #31 on: July 04, 2004, 08:50:04 PM »
You do need to edit out the "how many you want" etc. of course...

-[Unknown]

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: Advanced SSI FAQ
« Reply #32 on: July 04, 2004, 09:50:19 PM »
You do need to edit out the "how many you want" etc. of course...

-[Unknown]

thanks for the help, that's much faster!

One last question:
How do I get the newer topics to order from top to bottom of the page? Right now the newest topic is ordered at the bottom of the page.

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,142
  • Gender: Male
Re: Advanced SSI FAQ
« Reply #33 on: July 04, 2004, 09:51:29 PM »
Right before the line that says "LIMIT ...." put another line with "ORDER BY m.ID_MSG DESC".

-[Unknown]

Offline Elijah Bliss

  • Sophist Member
  • *****
  • Posts: 1,340
Re: Advanced SSI FAQ
« Reply #34 on: July 04, 2004, 09:54:58 PM »
Right before the line that says "LIMIT ...." put another line with "ORDER BY m.ID_MSG DESC".

-[Unknown]

YOU THA MAN! Thanks!

Offline Tom

  • Full Member
  • ***
  • Posts: 568
  • Gender: Male
    • Pogo Cheats
Re: Advanced SSI FAQ
« Reply #35 on: August 12, 2004, 04:19:37 PM »
How would you go about changing the font size of the output? (In my case, the recent posts function.)

Offline Tomer

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 1,662
  • Gender: Male
    • Aromazing
Re: Advanced SSI FAQ
« Reply #36 on: August 12, 2004, 04:23:47 PM »
You could just add a <font size='1'> tag.

Offline Tom

  • Full Member
  • ***
  • Posts: 568
  • Gender: Male
    • Pogo Cheats
Re: Advanced SSI FAQ
« Reply #37 on: August 12, 2004, 04:34:07 PM »
Hehe.. yes that would be the obvious thing to do. I can't believe I didn't think of that.  :-[

Thanks.  :)

Edit: Hmm, it dosen't appear to be working.
« Last Edit: August 12, 2004, 04:41:16 PM by Tom »

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,142
  • Gender: Male
Re: Advanced SSI FAQ
« Reply #38 on: August 12, 2004, 06:06:21 PM »
.ssi_table
{
   font-size: 8pt;
}

-[Unknown]

Offline Tom

  • Full Member
  • ***
  • Posts: 568
  • Gender: Male
    • Pogo Cheats
Re: Advanced SSI FAQ
« Reply #39 on: August 13, 2004, 09:24:05 AM »
Thanks !

Edit: Sorry, I really hate to be a pain. It still doesn't appear to be looking. The page is www.pogocheats.net and the CSS is on http://www.pogocheats.net/styles/main_style.css. Thanks very much for your help.
« Last Edit: August 13, 2004, 11:27:09 AM by Tom »