Different colours for different phpBB post types.

Technical Q&A involving operating systems, networking, software, and hardware issues.

Moderator: jasonb

Post Reply
User avatar
jasonb
Site Administrator
Posts: 105
Joined: Tue Apr 22, 2003 1:54 pm
Location: Toronto, Canada
Contact:

Different colours for different phpBB post types.

Post by jasonb »

The following will make "Announcement" appear as dark red, "Sticky" appear as dark green, and "Moved" appear as light grey. (If you use a different colour scheme, just edit the colours used in the stylesheet in the last step.)

With all of the following steps, it's assumed that "/" starts at the directory of your phpBB installation directory. Also, this is using the subSilver theme, and assumes that you're using "/templates/subSilver/subSilver.css" as your stylesheet file.
  1. Edit "/viewforum.php".
  2. Look for:

    Code: Select all

    $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
  3. Add the following:

    Code: Select all

     //
     // MOD: Post Colour
     //
     if( $topic_rowset[$i]['topic_type'] == POST_ANNOUNCE )
     {
           $row_class = 'post_announce';
     }
     else if( $topic_rowset[$i]['topic_type'] == POST_STICKY )
     {
           $row_class = 'post_sticky';
     }
     else if( $topic_rowset[$i]['topic_status'] == TOPIC_MOVED )
     {
           $row_class = 'post_moved';
     }
    //
    // END OF MOD: Post Colour
    //
  4. Edit "/templates/subSilver/viewforum_body.tpl"
  5. Look for:

    Code: Select all

    <td class="row1" width="100%"><span class="topictitle">{topicrow.NEWEST_POST_IMG}{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a></span><span class="gensmall"><br />
    Replace it with:

    Code: Select all

    <td class="row1" width="100%"><span class="topictitle">{topicrow.NEWEST_POST_IMG}<span class="{topicrow.ROW_CLASS}">{topicrow.TOPIC_TYPE}</span><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a></span><span class="gensmall"><br />
  6. Edit "/templates/subSilver/subSilver.css" (or whatever file you're using for your stylesheet - I believe the default install has stylesheet information located in "templates/subSilver/overall_header.tpl").
  7. Insert/append the following stylesheet declarations anywhere (wherever appropriate):

    Code: Select all

    .post_announce {font-weight: bold; color: #990000}
    .post_sticky {font-weight: bold; color: #084302}
    .post_moved {font-weight: bold; color: #999999}
That's it!
Post Reply