Separating the sticky topics from the normal ones

Started by Alexandre P., September 05, 2004, 06:23:54 PM

Previous topic - Next topic

Alexandre P.

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 :)
Aucun support par M.P., courriel ou messagerie instantanée / No support by P.M., email or I.M.

[Unknown]

I remember telling Owdy how to do this one.  Where did that topic go?

-[Unknown]

Ben_S

#2
Tips and tricks I beleive.

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

MessageIndex.template.php

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


Replace With

$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.
Liverpool FC Forum with 14 million+ posts.

127.0.0.1

I accomplished the same thing on my board differently with less code (my method probably sucks).

Find:


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



Add after:


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'];

[Unknown]

I would make it:

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]

Alexandre P.

Aucun support par M.P., courriel ou messagerie instantanée / No support by P.M., email or I.M.

TarantinoArchives

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

TarantinoArchives

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

evolus


~Tyris~

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


A.M.A

Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

Wolfden

can someone clarify this file name tho?  MessageIndex.template.php   - I'm not finding a template.php

Wolfden

ahhh I found it, taking me a bit to get use to the smf file system

SilentNoise

Quote from: TarantinoArchives 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

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?

[Unknown]


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

#16
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

[Unknown]


SilentNoise

oh ya.... I'm tired, and should go to bed.

Thanks again guys

Nederland


Advertisement: