News:

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

Main Menu

Topic Summary

Started by Nathaniel, August 26, 2008, 07:52:41 PM

Previous topic - Next topic

Nathaniel

That should be fairly easy. The main thing that you need to do, is to use the 'generate_summary($text)' function that is provided by this mod, to generate a summary of some text when you need to.

The edits below are to your 'SSI.php' file.

For the 'ssi_recentTopics' function. Find the code below:
      $row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']), array('<br />' => '')));
      if ($func['strlen']($row['body']) > 128)
         $row['body'] = $func['substr']($row['body'], 0, 128) . '...';


Replace with this code:
    $row['body'] = generate_summary($row['body']);

Then at the end of that SSI.php function, there is some html code. You will have to add the '$post['time']' php variable into that code. I can help you with that if you specify exactly where you want it.

Getting the 'ssi_topTopicsViews' to work will be harder, because it uses another SSI.php function and it doesn't load the body of the topic, I can still have a go at that if you want?
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

zaarin

#21
Hi LHVWB,

Thanks for your help with this. Sorry for the late reply, my wife just had a baby earlier in the week.

I've replaced the 3 lines, with the new line you said.

With regard to the $post['time'] php variable. It outputs the time the post was made. Do I need to modify something else, or call a different variable, to get the summary?

My HTML output (topic_summary, doesn't appear to output anything):
if ($output_method != 'echo' || empty($posts))
return $posts;

echo '
<ul>';
foreach ($posts as $post)
echo '
<li>
<h3><a href="', $post['href'], '">', $post['subject'], '</a></h3>
<p>', $post['topic_summary'], $post['time'], '</p>
</li>';
echo '
</ul>';
}


Thanks again for your help.

Edit: Oh, and yes, if you have the time, I would love to get ssi_topTopicsViews working as well. Thanks.

Nathaniel

Congratulations on the new child. :)

I apologise, I made a mistake when I wrote that post. You need to use the '$post['preview']' variable instead. ;)

For editing the 'ssi_topTopicsReplies' function. That function is based off the 'ssi_topTopics' function, so you will have to perform edits to the 'ssi_topTopics' function and then those changes will happen for the output from the 'ssi_topTopicsReplies' function as well.

Find this code (from that function):
SELECT m.subject, m.id_topic, t.num_views, t.num_replies
Replace with this code:
SELECT m.subject, m.id_topic, m.body, t.num_views, t.num_replies

Find this code:
        $topics[] = array(
            'id' => $row['id_topic'],

Replace with this code:
        $row['body'] = generate_summary($row['body']);
   
        $topics[] = array(
            'id' => $row['id_topic'],
            'preview' => $row['body'],


Find this code:
                <td align="right">', $topic['num_views'], '</td>
                <td align="right">', $topic['num_replies'], '</td>

Replace with this code:
                <td align="right">', $topic['num_views'], '</td>
                <td align="right">', $topic['num_replies'], '</td>
                <td align="right">', $topic['preview'], '</td>


As with the 'ssi_recentTopics' function, the last edit may be different depending on how you want the HTML output to look. :)
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

zaarin

Perfect. Thanks very much for your help.

Nathaniel

Tested Compatibility with SMF 1.1.7, the mod page has been updated accordingly.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

cleanfiles

#25
Hey great mod, and works for me on 1.1.7 default theme.

I am using this mod "Look But No Read" So guests can see the boards and posts but not read the posts
I was wondering if it would be possible to turn the summery off for guests as it can giv to much of the post away lol?

Nathaniel

@cleanfiles,
The edits below (to your 'MessageIndex.template.php' file) assume that the mod has been installed normally.

Find this code:
<td class="windowbg2" valign="middle" ', (!empty($modSettings['TopicSummary_column_width']) ? 'width="'.$modSettings['TopicSummary_column_width'].'"' : ''), '>
', $topic[!empty($modSettings['TopicSummary_message']) ? $modSettings['TopicSummary_message'] : 'last_post']['summary'], '
</td>
<td class="windowbg2" valign="middle" width="14%">
', $topic['first_post']['member']['link'], '
</td>


Replace with this code:
', !empty($context['user']['is_guest']) ? '' : '<td class="windowbg2" valign="middle" ' . (!empty($modSettings['TopicSummary_column_width']) ? 'width="'.$modSettings['TopicSummary_column_width'].'"' : '') . '>
', $topic[!empty($modSettings['TopicSummary_message']) ? $modSettings['TopicSummary_message'] : 'last_post']['summary'], '
</td>', '
<td class="windowbg2" valign="middle" width="14%">
', $topic['first_post']['member']['link'], '
</td>


Find this code:
<td class="catbg3"><a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=subject', $context['sort_by'] == 'subject' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt[70], $context['sort_by'] == 'subject' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></td>

<td class="catbg3" ', (!empty($modSettings['TopicSummary_column_width']) ? 'width="'.$modSettings['TopicSummary_column_width'].'"' : ''), '>', $txt[468], '</td>


Replace with this code:
<td class="catbg3"><a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=subject', $context['sort_by'] == 'subject' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt[70], $context['sort_by'] == 'subject' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></td>

', !empty($context['user']['is_guest']) ? '' : '<td class="catbg3" ' . (!empty($modSettings['TopicSummary_column_width']) ? 'width="'.$modSettings['TopicSummary_column_width'].'"' : '') . '>' . $txt[468] . '</td>', '
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

cleanfiles

I will give that a go, thanks :)

Uhura!

:) Our Parenting Spot is an online parenting community for fathers, mothers, grandparents, teachers, and family service professionals. 8) We also provide low cost advertising options for authors, family service providers, and businesses with family friendly products and services. ;D Visit us @ www.OurParentingSpot.net!

Nathaniel

v1.02 - 20 November 2009
Updated for SMF 2 RC2.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Tiribulus

This is pretty spiffy dude. I don't know how I missed this one. Had to do the editing for the MessageIndex.template.php for my theme and one for the modsettings file, but works great

jack3d

#31
For some reason, I'm having trouble uninstalling this? I personally love it but a few people complained about how it posted spoilers and majority opted for it to be removed lol.

When I view my packages summary, it is not there. When I view my installed packages, it is there but when I click uninstall, it says that it cannot locate the package file.

Any help would be rockin'.

ETA: Internet cut out haha. The 'installed' version, with the missing file, is 1.01.

jack3d

I understand that it's very rude for me to ask... and ask again... but any help would be greatly appreciated.  :)

GoldieFR

SMF 2.0 RC3
my mods [nofollow]

Nathaniel

v1.3 - 5 November 2010
Updated for SMF 2 RC4.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Apllicmz




helike13

It would be better idea to add a description under the topic name to make them look like child forums.

danialasghar

Can i use this mod in Smf 2.0 RC5?

live627

You can certainly give it a try.

Nathaniel

Updated to include the portuguese translation. Thanks Joomlamz, apologies I didn't notice it ages ago, lol. :/

Quote from: danialasghar on June 06, 2011, 08:39:43 PM
Can i use this mod in Smf 2.0 RC5?

I believe so, it certainly works in SMF 2.0 final.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Advertisement: