SMF 2.1 removing character limit on "last post" title on board index (homepage)

Started by Wellwisher, September 11, 2015, 02:30:33 AM

Previous topic - Next topic

Wellwisher

Hello SMF Devs and community,

I am trying to remove the character limit on "last post" topic title on board index (homepage):



Any help would be pretty sweet bros. Thank you.

Antechinus

Sources/Subs-BoardIndex.php:

// Provide the href and link.
if ($row_board['subject'] != '')
{
$this_last_post['href'] = $scripturl . '?topic=' . $row_board['id_topic'] . '.msg' . ($user_info['is_guest'] ? $row_board['id_msg'] : $row_board['new_from']) . (empty($row_board['is_read']) ? ';boardseen' : '') . '#new';
$this_last_post['link'] = '<a href="' . $this_last_post['href'] . '" title="' . $row_board['subject'] . '">' . $row_board['short_subject'] . '</a>';


See where it says "$row_board['short_subject']"? Just change that to "$row_board['subject']" like the title attribute.

Antechinus

Come to think of it, if you're keen to get the last possible tiny improvements in performance, you could also get rid of this line:

$row_board['short_subject'] = shorten_subject($row_board['subject'], 24);

And change this:

'subject' => $row_board['short_subject'],

To this:

'subject' => $row_board['subject'],

Do back your file up before trying this stuff though. Just in case.

Wellwisher

Quote from: Antechinus on September 11, 2015, 02:48:31 AM
Come to think of it, if you're keen to get the last possible tiny improvements in performance, you could also get rid of this line:

$row_board['short_subject'] = shorten_subject($row_board['subject'], 24);

And change this:

'subject' => $row_board['short_subject'],

To this:

'subject' => $row_board['subject'],

Do back your file up before trying this stuff though. Just in case.

Awesome, awesome tip @Antechinus and thank you again. I wouldn't have been able to find this on my own. I think this is also true also for 2.0 versions. Doing it this way is a bonus for mid to large forum owners; plus a cleaner code that boosts performance is a no brainer. Thank you again, the code is a great help.


Antechinus

Oh, I forgot this was in the 2.1 board. I actually got that code from the 2.0.x files. :D

Wellwisher

Well I just tested it, the code works for both versions at the moment. I also just updated my production site with your code.  ;D

Antechinus

Oh I thought of something else. The title attribute on that link is only provided because the visible text is usually truncated. Since you're not truncating the visible text, the title attribute on your site doesn't provide any more information than the standard text itself.

In this case the title is just bloat, since its only purpose is to provide extra information. So, you can get yourself another infinitesimal gain in server and browser performance by getting rid of the title if you want to.*

Code (Find) Select
'<a href="' . $this_last_post['href'] . '" title="' . $row_board['subject'] . '">' . $row_board['short_subject'] . '</a>';

Code (Replace) Select
'<a href="' . $this_last_post['href'] . '">' . $row_board['subject'] . '</a>';


I wonder if there would be any call for this as a mod package.


*Either that or edit it to say surprising things at people. Your choice. :D

Wellwisher

I don't think this small tweak is mod worthy. But with that said, I am sure there are tone of these tweaks (that you're probably aware of) that could boost performance for everyone; especially for those who run mid to large forums! Grouping these 'performance based tweaks' into a "singular mod" which then the mod author keeps updating and adding more of these types of tweaks will become really popular among the smf users - no doubt in my mind.

Once this mod wins over the SMF community and builds its credibility, you could then build a premium mod with even more performance tweaks options to help pay for the time you spent on it. I wouldn't mind paying a couple of bucks to have this type of thing taken care of for me.  ;D

Jade Elizabeth

Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Antechinus

Ok, go ahead and write it then. :D

*haz great confidence in your ability*

Advertisement: