Advertisement:

Author Topic: Separating the sticky topics from the normal ones  (Read 134364 times)

Offline Alexandre P.

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,044
  • Gender: Male
    • LivreSansPage
Separating the sticky topics from the normal ones
« on: September 05, 2004, 06:23:54 PM »
Hi,

I would like to know how to separate the sticky topics from the rest of the normal topics.  Like what you could see on this IPB-powered board or this PhpBB-powered board: the sticky topics are separated from the normal ones.

I believe this modification should be made in MessageIndex.template.php, around line 126 or 156, but I don't know how to determine if a topic is sticky or normal :-\

Thanks all :)
« Last Edit: February 12, 2008, 11:07:37 PM by SleePy »
Aucun support par M.P., courriel ou messagerie instantanée / No support by P.M., email or I.M.

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Separating the sticky topics grom the normal ones
« Reply #1 on: September 05, 2004, 06:37:07 PM »
I remember telling Owdy how to do this one.  Where did that topic go?

-[Unknown]

Offline Ben_S

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 11,702
  • xxx
Re: Separating the sticky topics grom the normal ones
« Reply #2 on: September 05, 2004, 06:37:36 PM »
Tips and tricks I beleive.

Well it did, but now the topic is in the bin ???

MessageIndex.template.php

Find
Code: [Select]
foreach($context['topics'] as $topic)
{

Replace With
Code: [Select]
$stickybar = false;
$normalbar = false;
foreach($context['topics'] as $topic)
{
if($topic['is_sticky'] && !$stickybar)
{
echo'<tr class="titlebg"><td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Important Topics</b></td></tr>';
$stickybar = true;
}
else if(!$topic['is_sticky'] && $stickybar && !$normalbar)
{
echo'<tr class="titlebg"><td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Normal Topics</b></td></tr>';
$normalbar = true;
}

I take no credit for that, just a copy and paste.
« Last Edit: September 05, 2004, 06:41:34 PM by Ben_S »
Liverpool FC Forum with 14 million+ posts.

Offline 127.0.0.1

  • Jr. Member
  • **
  • Posts: 265
  • Gender: Male
Re: Separating the sticky topics grom the normal ones
« Reply #3 on: September 05, 2004, 07:05:20 PM »
I accomplished the same thing on my board differently with less code (my method probably sucks).

Find:

Code: [Select]
foreach ($context['topics'] as $topic)
{


Add after:

Code: [Select]
if (isset($previousTopicClass))
echo (ereg("sticky", $previousTopicClass) && !ereg("sticky", $topic['class'])) ? '
<tr>
<td>&nbsp;</td>
<td colspan="5">' . $txt[70] . '</td>
</tr>' : '';

$previousTopicClass = $topic['class'];

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Separating the sticky topics grom the normal ones
« Reply #4 on: September 05, 2004, 07:18:19 PM »
I would make it:
Code: [Select]
if (isset($previousTopicClass) && strpos($previousTopicClass, 'sticky') !== false && !$topic['is_sticky'])
echo '
<tr>
<td>&nbsp;</td>
<td colspan="5">' . $txt[70] . '</td>
</tr>';
$previousTopicClass = $topic['class'];

-[Unknown]

Offline Alexandre P.

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,044
  • Gender: Male
    • LivreSansPage
Re: Separating the sticky topics grom the normal ones
« Reply #5 on: September 05, 2004, 09:45:02 PM »
This is just excellent :D  Thanks all !
Aucun support par M.P., courriel ou messagerie instantanée / No support by P.M., email or I.M.

Offline TarantinoArchives

  • Full Member
  • ***
  • Posts: 442
  • Gender: Male
  • Call it, friendo
    • The Quentin Tarantino Archives
Re: Separating the sticky topics from the normal ones
« Reply #6 on: September 07, 2004, 02:02:54 PM »
I think the second solution doesnt look very elegant. The first one seems to be more into what the idea behind this is, to mark those "important" and all.

somehow, when i tried out the first solution, it gives me a parsing error and something about single quotes and all. could somebody in here check this one and maybe post a better solution, that would be very nice. I think this should actually be part of SMF as an admin option, kinda like "enable seperating of sticky topics" or something like that

Offline TarantinoArchives

  • Full Member
  • ***
  • Posts: 442
  • Gender: Male
  • Call it, friendo
    • The Quentin Tarantino Archives
Re: Separating the sticky topics from the normal ones
« Reply #7 on: September 07, 2004, 03:33:12 PM »
ah well, here's what i did now:

Quote
if (isset($previousTopicClass) && strpos($previousTopicClass, 'sticky') !== false && !$topic['is_sticky'])
      echo '
         <tr class="titlebg">
         <td colspan="2">&nbsp;</td>
         <td colspan="7">&nbsp;</td>
         </tr>';
$previousTopicClass = $topic['class'];

basically, the sedong TD can have some title like "normal topics", the first TD is just to align it. I added the TR class to have the bar in the same CSS style

Offline evolus

  • Jr. Member
  • **
  • Posts: 212
  • Gender: Male
  • ∞ Geek Social ∞
    • evolus
Re: Separating the sticky topics from the normal ones
« Reply #8 on: September 08, 2004, 09:09:45 AM »
Thanx all, that was for me :)
Jabber evolus@jabber.org

Offline ~Tyris~

  • Semi-Newbie
  • *
  • Posts: 13
  • Gender: Male
  • The only yabbpak server you'll ever need
Seperating Stickys From Normal Topics
« Reply #9 on: September 27, 2004, 04:36:47 PM »
Awhile ago this script was posted... but i cant find it now it would be nice to use it to make things look neater; was just wondering if the code could be re-posted? thanks! :)
0.0

Offline Ben_S

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 11,702
  • xxx
Liverpool FC Forum with 14 million+ posts.

Offline A.M.A

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,133
  • Gender: Male
  • ..
Re: Separating the sticky topics from the normal ones
« Reply #11 on: September 27, 2004, 05:35:57 PM »
merged topics ..
Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

Offline Wolfden

  • Semi-Newbie
  • *
  • Posts: 10
Re: Separating the sticky topics from the normal ones
« Reply #12 on: September 29, 2004, 10:34:08 PM »
can someone clarify this file name tho?  MessageIndex.template.php   - I'm not finding a template.php

Offline Wolfden

  • Semi-Newbie
  • *
  • Posts: 10
Re: Separating the sticky topics from the normal ones
« Reply #13 on: September 29, 2004, 10:59:43 PM »
ahhh I found it, taking me a bit to get use to the smf file system

SilentNoise

  • Guest
Re: Separating the sticky topics from the normal ones
« Reply #14 on: October 01, 2004, 03:08:49 AM »
ah well, here's what i did now:

Quote
if (isset($previousTopicClass) && strpos($previousTopicClass, 'sticky') !== false && !$topic['is_sticky'])
      echo '
         <tr class="titlebg">
         <td colspan="2">&nbsp;</td>
         <td colspan="7">&nbsp;</td>
         </tr>';
$previousTopicClass = $topic['class'];

basically, the sedong TD can have some title like "normal topics", the first TD is just to align it. I added the TR class to have the bar in the same CSS style

This is exactly what I was looking for, except for one thing... I was hoping to make that bar about 1/2 the height. Is there any way to change this?

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Separating the sticky topics from the normal ones
« Reply #15 on: October 01, 2004, 03:10:10 AM »
Code: [Select]
if (isset($previousTopicClass) && strpos($previousTopicClass, 'sticky') !== false && !$topic['is_sticky'])
echo '
<tr class="titlebg" style="font-size: 1ex;">
<td colspan="2">&nbsp;</td>
<td colspan="7">&nbsp;</td>
</tr>';
$previousTopicClass = $topic['class'];

-[Unknown]

SilentNoise

  • Guest
Re: Separating the sticky topics from the normal ones
« Reply #16 on: October 01, 2004, 03:25:44 AM »
That didn't do anything to shrink the height of the seperator line. ???

TarantinoArchives' board shows the size that I'm roughly looking for: http://tarantino.loucreative.de/forum/index.php?PHPSESSID=480e0db079a06cab594c0b26163b269b&board=4.0
« Last Edit: October 01, 2004, 03:30:14 AM by SilentNoise »

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: Separating the sticky topics from the normal ones
« Reply #17 on: October 01, 2004, 03:38:41 AM »
Try removing the &nbsp; parts.

-[Unknown]

SilentNoise

  • Guest
Re: Separating the sticky topics from the normal ones
« Reply #18 on: October 01, 2004, 03:49:06 AM »
oh ya.... I'm tired, and should go to bed.

Thanks again guys

Offline Nederland

  • Semi-Newbie
  • *
  • Posts: 46
Re: Separating the sticky topics from the normal ones
« Reply #19 on: November 01, 2004, 08:38:14 AM »
I'll try to use this trick, thanks guys!!