TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,970
  • Latest: bynw
Stats
  • Total Posts: 196,031
  • Total Topics: 21,335
  • Online today: 321
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 278
  • Total: 279
  • lurkalot

Shortening the topic name in Recent Topics SSI

Started by layne, March 14, 2007, 04:35:46 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

layne

I'm using an edited recent topics SSI that pulls the topics by board, but it shows the whole topic title, versus the normal recent topics SSI which shows a shortened version of the title ending in "..."

How do i reproduce this effect in my current SSI? Here's my current code:

<p align="left" class="indented"><?php global $context, $scripturl, $settings, $txt;
$bullet = '<img src="'.$settings['images_url'].'/TPdivider.gif" alt="" border="0" style="margin:0 2px 0 0;" />';

$result=ssi_recentTopics_Include(3,array(12),'return');

foreach(
$result as $my){
 echo
"$bullet";
 echo
'<span class="smalltext">'.$my['link'];

 
// is this topic new? (assume they are logged in)
if (!$my['new'] && $context['user']['is_logged'])
       echo
' <a href="', $scripturl, '?topic=', $my['topic'], '.from', $my['new_from'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
echo
'<br />';
echo
' last post by <b>', $my['poster']['link'];
echo
'</b><br />';
//echo ' last post ', $my['time'];
echo '<br />';//

}
echo
'</span>';?></p>

IchBin

#1
All you need to know about the SMF function ssi_recentTopics. :D
Click Me

layne

#2
yeah, i can't figure out how to use the "short_subject" string in my code.  i tried replacing "topic" but other than that i can't figure it out.

G6Cad

Here is some reading, but i think you will actually get all the answers in this topic.
I know it-s a long thread, but if you start fronm the last post and read your way to the first, i know tou will have what you look for.
http://www.tinyportal.net/index.php?topic=596.0

IchBin

Change this line:
echo '<span class="smalltext">'.$my['link'];

To this line:
echo '<span class="smalltext"><a href="', $scripturl,'?topic=',$my['topic'], '.from', $my['new_from'], '#new">', shorten_subject($my['subject'], 8), '</a>';

You can change the number "8" to a lower or higher number depending on how much text you want to show in the link.

layne

thanks, man. exactly what i needed. i'm still not sure i understand what i did, but i know it worked, and in the end that'ss all that matters.  didn't mean to cross post, by the way. the two threads converged, but i thought they were different enough at the start. sorry bout that...

This website is proudly hosted on Crocweb Cloud Website Hosting.