• Welcome to Simple Machines Community Forum. Please login or sign up.
December 03, 2021, 09:35:54 PM

News:

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


SSI Topic and Replies

Started by tyty1234, April 06, 2007, 07:35:13 AM

Previous topic - Next topic

handyrefuse

ya RC3 ... so i can do the package install and just ignore the error that pops up for that file?

tyty1234

Quote from: handyrefuse on April 02, 2010, 09:05:00 PM
ya RC3 ... so i can do the package install and just ignore the error that pops up for that file?
That's correct. The mod should work as normal.
Should you encounter any bugs/errors, please let me know. Thanks. :)
My Activity: Inactive
My Links: tyty1234's SMF Site | SMF Package Parser | SMF Helper | My Mods [5]
Subscribe to my SMF blog for updates
PMs for support will not be accepted, unless requested otherwise.

Bijan641

Quote from: Bijan641 on March 10, 2010, 03:31:03 PM

$topicNum = 97;
$replies = 15;
$startPost = 1;

$return = ssi_topic($topicNum, $replies, $startPost, 'array'); // Setting something to 'null' will use the default value.

// Loop through each post
foreach ($return['replies'] as $post)
{
echo '
<div style="background-color:#cee2ff; color:#000; border:solid; border-width:thin; border-color:#000; padding:3px;">
<div>
<a href="', $post['href'], '"><b>', $post['subject'], '</b></a>
<div class="smaller">', $post['time'], ' Posted by ', $post['poster']['link'], '</div>

<div>', $post['body'], '</div>
</div>';

// The last post? Let's put the page numbers
        if ($post['is_last'])
echo '
', $return['pageindex'];
else
echo '
<br /></div>';

}


http://www.dotswoof.com/theater/t.php                         - code source
http://www.dotswoof.com/forum/index.php?topic=97.30   - original forum topic

I am having trouble getting this function to work. For some reason, the pagination doesn't work at all and it grabs from the end instead of at the starting position I tell it to. I submitted links to the original topic and the malfunctioning page so you could see for yourself.

Bumping my original request for help. Can't seem to figure it out.

Update on the information though. It works when I do the normal echo output, but it doesn't when I try to use the array.

tyty1234

You might want to try the latest version released. Maybe it might help you. If not please let me know and I'll be happy to help. :)
My Activity: Inactive
My Links: tyty1234's SMF Site | SMF Package Parser | SMF Helper | My Mods [5]
Subscribe to my SMF blog for updates
PMs for support will not be accepted, unless requested otherwise.

Özgür

I need to calling avatars on topic replys. I try add this in final while.
loadMemberContext($row['id_member']);
  $avatarx =  $memberContext[$row['id_member']]['avatar']['image'];

And call this in foreach
',$avatarx,'
But avatars not showing up. I really need help on this. Seems not impossible to me. But i guess, i would be skip something.
Can you help me?
So Long

Özgür

So Long

Roph

I'm confused why this isn't made a default feature of SSI.php, it seems like an obvious inclusion.

Either way, I just wanted to thank you for the good work, I used this on a site of mine and it's very useful :)

Arantor

The reason it's not in SSI.php is because there's already a heckuva lot of stuff in there and the line has to be drawn somewhere.
No good deed goes unpunished
All helpful urges should be circumvented

diontoradan

okay, how can i exclude comments? and secondly i get 404 error for the pagination...

Özgür

Quote from: Daydreamer on April 13, 2010, 03:26:22 PM
I need to calling avatars on topic replys. I try add this in final while.
loadMemberContext($row['id_member']);
  $avatarx =  $memberContext[$row['id_member']]['avatar']['image'];

And call this in foreach
',$avatarx,'
But avatars not showing up. I really need help on this. Seems not impossible to me. But i guess, i would be skip something.
Can you help me?
So Long

Roph

Just thought I'd bump this to point out that while BBCode is parsed, censoring text isn't. You can fix this by just wrapping censortext() around wherever you output the body of the message or replies. :)

Bijan641

Quote from: diontoradan on May 21, 2010, 06:09:54 PM
and secondly i get 404 error for the pagination...

I am also getting this error. I am also unable to put the entire thread in one array so as to create my own pagination. I don't know enough about php and databases to re-write the entire code, but I'm pretty desperate to figure this out.

Roph

Putting the ENTIRE topic into an array in order to count the items (I assume this is what you want) is very inefficient. This mod actually does the work for you.

You can use the [reply_count] var to know how many items there are in the topic, to create your pagination :)

Bijan641

OK so I finally was able to get it to work by using the normal echo output and just editing everything the way I want it in the SSI file.

I have a new question now (I know, they never end). How do I go about formatting certain BB-code stuff?

For example, quoted text looks terrible. Also, we allow users to post youtube videos, but we don't want them to be shown when we use ssi_topic.

Is there a way to format the bb-code on output?

Roph

The output has BBCode already parsed.

View the source of the output and you'll see that quotes are made up of a few <divs> and a <blockquote> tag. You can just style these with CSS.

ExcalibursZone

October 06, 2010, 10:55:15 AM #95 Last Edit: October 06, 2010, 12:21:01 PM by ExcalibursZone
I found a few omissions in the code that I needed for my particular application of this mod:
1) While the mod pulls the modified_time for replies, it does not do so for the main post.
2) If a topic cannot be found, you get shunted to your install of SMF with an error.

I modified the mod with the following changes:

***install-1.xml, Line 44; install-2.xml, Line 43:
***Change:
m.posterTime, m.body, m.smileysEnabled, m.ID_MSG, IFNULL(mem.realName, m.posterName) AS posterName, b.name AS board_name

***To:
m.posterTime, m.modifiedTime, m.body, m.smileysEnabled, m.ID_MSG, IFNULL(mem.realName, m.posterName) AS posterName, b.name AS board_name

***install-1.xml, Lines 53-55; install-2.xml, Lines 56-58:
***Change:
// No topic? That can't be good.
if (mysql_num_rows($request) == 0)
fatal_lang_error('ssiTopic_notfound');

***To:
// No topic? That can't be good.
if (mysql_num_rows($request) == 0)
{
if ($output_method == 'echo')
fatal_lang_error('ssiTopic_notfound');
else
return array();
}

***install-1.xml:
Insert this line:
'mod_timestamp' => forum_time(true, $row['modifiedTime']),
AFTER:
'timestamp' => forum_time(true, $row['posterTime']),


***install-2.xml:
Insert this line:
        'mod_timestamp' => forum_time(true, $row['modified_time']),
AFTER:
        'timestamp' => forum_time(true, $row['poster_time']),


After I make those changes, I re-zip the file and reinstall to the server. Works wonderfully now.

I just wish there was an ssi_subjects() method that allowed  you to grab all the message subjects across the forum or for certain boards. Maybe I'll look into adding that functionality to this mod (for my copy anyway) since it sort of fits what this mod does.

I just repackaged it as ssi_topic1.4e if that's OK with the author.

***Updated to include return values***

Roph

Quote from: ExcalibursZone on October 06, 2010, 10:55:15 AM
I found a few omissions in the code that I needed for my particular application of this mod:
1) While the mod pulls the modified_time for replies, it does not do so for the main post.
2) If a topic cannot be found, you get shunted to your install of SMF with an error.

I modified the mod with the following changes:

***install-1.xml, Line 44; install-2.xml, Line 43:
***Change:
m.posterTime, m.body, m.smileysEnabled, m.ID_MSG, IFNULL(mem.realName, m.posterName) AS posterName, b.name AS board_name

***To:
m.posterTime, m.modifiedTime, m.body, m.smileysEnabled, m.ID_MSG, IFNULL(mem.realName, m.posterName) AS posterName, b.name AS board_name

***install-1.xml, Lines 53-55; install-2.xml, Lines 56-58:
***Change:
// No topic? That can't be good.
if (mysql_num_rows($request) == 0)
fatal_lang_error('ssiTopic_notfound');

***To:
// No topic? That can't be good.
if (mysql_num_rows($request) == 0)
{
if ($output_method == 'echo')
fatal_lang_error('ssiTopic_notfound');
else
return array();
}

***install-1.xml:
Insert this line:
'mod_timestamp' => forum_time(true, $row['modifiedTime']),
AFTER:
'timestamp' => forum_time(true, $row['posterTime']),


***install-2.xml:
Insert this line:
        'mod_timestamp' => forum_time(true, $row['modified_time']),
AFTER:
        'timestamp' => forum_time(true, $row['poster_time']),


After I make those changes, I re-zip the file and reinstall to the server. Works wonderfully now.

I just wish there was an ssi_subjects() method that allowed  you to grab all the message subjects across the forum or for certain boards. Maybe I'll look into adding that functionality to this mod (for my copy anyway) since it sort of fits what this mod does.

I just repackaged it as ssi_topic1.4e if that's OK with the author.

***Updated to include return values***

For the subjects, you can just use ssi_boardnews and echo what you need from it. If you're planning to get more than a couple subjects and if you only ever want the subjects, you can just make a copy of ssi_boardnews and trim it down. A trimmed down boardnews is how I do this page. Using the vanilla boardnews it takes over 30 seconds.

ExcalibursZone

yeah, thanks :) I did it basically the same way and it's working pretty well.

I'm using SMF for holding web page content away from the structure (like a CMS) T&R saved me in that respect. Now I can just worry about structure issues while my content providers can worry about content.

pjn

can i see demo for this mod?
Quick Portal - Free hosting & portal & forums system

Many designs + many extras + server = FREE!

Ask from us your free web now:
http://qp-free.com/index.php/board,2.0.html

ExcalibursZone

All the mod does is grab a topic and it's comments (see first entry on first page). It's added to SSI.php and provides you with an echo or an array in much the same way that all the other SSI functions do.

The author of this mod may have a demo visible, but it'd look like a topic in your forum or an array of that content.

Advertisement: