News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Separating the sticky topics from the normal ones

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

Previous topic - Next topic

eclipselv

Quote from: [Unknown] on January 21, 2005, 03:34:02 AM
You can use this:


if (isset($previousTopicClass) && strpos($previousTopicClass, 'sticky') !== false && !$topic['is_sticky'])
echo '
<tr>
<td width="9%" colspan="2"></td>
<td>', $txt[70], '</td>
<td width="14%">', $txt[109], '</td>
<td width="4%" align="center">', $txt[110], '</td>
<td width="4%" align="center">', $txt[301], '</a></td>
<td width="22%">', $txt[111], '</a></td>
</tr>';
$previousTopicClass = $topic['class'];


-[Unknown]

I added this after:
foreach ($context['topics'] as $topic)
   {

and nothing happened.... i have board 1.0.1

thanks for any help
elv

[Unknown]

Quote from: bobert on February 07, 2005, 04:43:29 PM
Is there a way to get rid of those stupid gray bars that say subject. I tried every piece of code here, and none of them seemed to work. Here is by board= http://krawproductions.com/smf/index.php?board=2.0;sort=last_post;desc

Looks like you didn't apply it as described.

Quote from: eclipselv on February 11, 2005, 09:28:31 PM

I added this after:
foreach ($context['topics'] as $topic)
{

and nothing happened.... i have board 1.0.1

Are you sure you did it for the correct template file?  For example, you might be using the "classic" or "converted" theme.

-[Unknown]

eclipselv

#42
yes, i did it for the correct template.
i dont understand... i dont see anything different. It does not give any kind of error either..
is there a setting or something i need to turn on?
Im a newb at this board.

here is my board:
http://www.texasdwarfcar.com/forum/ [nofollow]

please help
eclipselv

DeadMetal

I'd like to do something simpeler, but I need a little help.
I only want to add the text 'Sticky:' in front of the title of a sticky topic.
It should be easy, but I don't succeed.

Kindred

There's another thread floating around that describes exactly how to do this...

(do a search?)

but specifically, in MesageIndex.template.php, you need to have this code where it checks for the first post...

                        <span style="', $topic['is_sticky'] ? 'font-weight: bold;' : '', $topic['is_locked'] ? 'font-style: italic;' : '', '" title="', $topic['first_post']['preview'], '">
                                ', $topic['is_sticky'] ? 'Sticky: ' : ($topic['is_locked'] ? 'Locked: ' : ''), ' ', $topic['first_post']['link'], '
                        </span>';
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

eclipselv

I finally got this separator to work.
I had to reinstall the forum and now it works fine.
Don't ask me what the prob was, cause I don't know.
------------------------
Quote from: kindred on February 13, 2005, 10:11:29 AM
There's another thread floating around that describes exactly how to do this...

(do a search?)

but specifically, in MesageIndex.template.php, you need to have this code where it checks for the first post...

<span style="', $topic['is_sticky'] ? 'font-weight: bold;' : '', $topic['is_locked'] ? 'font-style: italic;' : '', '" title="', $topic['first_post']['preview'], '">
', $topic['is_sticky'] ? 'Sticky: ' : ($topic['is_locked'] ? 'Locked: ' : ''), ' ', $topic['first_post']['link'], '
</span>';


I'm a newb at this forum, and when it comes to editing code.
Can someone help me out on the code I need to find to place labels in front of stickies.
I did a search and found nothing.
I would like someone to tell me exactly where to place this code... Does anyone know?
I want to thank all of you for your help, it makes transitioning to a new forum much easier.

Eclipselv

Midgard

I love you Ben :) :P

Meanwhile, which one true? (from codes?)

Xarcell

He's right, fer some reason it seperates the stickies, but has the first post mixed in with it. Where do I place that <span> code?

-Xarcell

anshar

Great topic, I've got a question....

How to make this separate bar thiner, with different font colour on it ? (atm fonts are black, and I need white)

dtm.exe


Poppet

Quote from: anshar on June 23, 2005, 01:45:02 PM
Great topic, I've got a question....

How to make this separate bar thiner, with different font colour on it ? (atm fonts are black, and I need white)

I'd like the font to be white too  :)

ernomo98

I only find foreach ($context['boards'] as $board) in my MessageIndex.template.php
is this the same?
can I replace this with the follow code?
Quote$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;
}

ernomo98


Sol

How would I go about editing this in SMF 1.1 Beta 3?

I know you moved some stuff to sub files but I couldn't find any of this code so I guess you've redone this piece of code or something. Have I missed something or is this mod useless now?

Sol edit: Sorry. SMF 1.1 (Beta 3) has a space between the foreach and the reat of the code. Fixed it now.

Jochus


pierse

Quote from: TarantinoArchives on December 31, 2004, 07:58:38 AM
Quote
// No topics.... just say, "sorry bub".
   else
      echo '
               <td width="100%" colspan="7"><b>', $txt[151], '</b></td>';

   echo '
            </tr>';

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

      echo '
            <tr>
               <td class="windowbg2" valign="middle" align="center" width="5%">
                  <img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
               </td>
               <td class="windowbg2" valign="middle" align="center" width="4%">
                  <img src="', $settings['images_url'], '/post/', $topic['first_post']['icon'], '.gif" alt="" />
               </td>
               <td class="windowbg" valign="middle">
                  ', $topic['first_post']['link'];

i replace the bold text with what was suggested in this topic

This worked like a charm! Thanks guys!

Xarcell

The script works well, but what if I want a another line above the sticky posts just like the one below.

How can I do that?

Thanx,

-Xarcell, php noob.

edi67

not work with SMF 1.1 somebody have some solution for I would like to know how to separate the sticky topics from the rest of the normal topics.

???
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

TLM

Quote from: edi67 on October 02, 2005, 03:14:46 AM
not work with SMF 1.1 somebody have some solution for I would like to know how to separate the sticky topics from the rest of the normal topics.

???
It does work, got it working on my forums.

MessageIndex.template.php starting at about line 150

// No topics.... just say, "sorry bub".
else
echo '
<td width="100%" colspan="7"><b>', $txt[151], '</b></td>';

echo '
</tr>';

        //For the stick/nonstick listings...
        $stickybar = false;
    $normalbar = false;

foreach ($context['topics'] as $topic)
{
            if($topic['is_sticky'] && !$stickybar)
            {
                echo'
                <tr class="windowbg2">
                    <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="windowbg2">
                    <td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Normal Topics</b></td></tr>';
                $normalbar = true;
            }

echo '
<tr class="windowbg2">
<td valign="middle" align="center" width="5%">

spaceman

Quote from: TLM on October 02, 2005, 11:58:15 PM
Quote from: edi67 on October 02, 2005, 03:14:46 AM
not work with SMF 1.1 somebody have some solution for I would like to know how to separate the sticky topics from the rest of the normal topics.

???
It does work, got it working on my forums.

MessageIndex.template.php starting at about line 150

// No topics.... just say, "sorry bub".
else
echo '
<td width="100%" colspan="7"><b>', $txt[151], '</b></td>';

echo '
</tr>';

        //For the stick/nonstick listings...
        $stickybar = false;
    $normalbar = false;

foreach ($context['topics'] as $topic)
{
            if($topic['is_sticky'] && !$stickybar)
            {
                echo'
                <tr class="windowbg2">
                    <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="windowbg2">
                    <td colspan="', empty($options['display_quick_mod']) ? '7' : '8', '"><b>Normal Topics</b></td></tr>';
                $normalbar = true;
            }

echo '
<tr class="windowbg2">
<td valign="middle" align="center" width="5%">


Got it working on my forum and it looks nice! Thank you very much! :D

http://freshmidis.uni.cc/v2/forums/index.php?board=1.0

Advertisement: