Firefox PHP

Horizontal rule or space between threads?

Posted by pulloff 
Horizontal rule or space between threads?
September 17, 2008 11:51AM
People on my site seem to like the threaded format much better and thankfully phorum has the good old threaded option (I guess my viewers are still used to the old wwwboard format).

I was wondering if anyone knows what template(s) to alter to put a horizontal line or a space between two different threads or if this is even possible. I’ve got the height spacing of the threads and the alternating background colors of alternating threads but I just want each individual thread to stand out a little more and I think a space or thin horizontal line would help. Anyone have any ideas where I should start?


Jake Morgan

www.PULLOFF.com
Independent Pulling News
Re: Horizontal rule or space between threads?
September 17, 2008 12:00PM
You should take a look at the list_threads.tpl template file. That one renders the threaded message list for a forum.

A bit of code that I used in my own site's template looks like this:

{LOOP MESSAGES}
  ...
  ...
  <?php 
  $curthread = $PHORUM['TMP']['MESSAGES']['thread'];
  if (! isset($oldthread)) $oldthread = $curthread;
  $separator = ($oldthread != $curthread) ? 'phorum-separator' : '';
  $oldthread = $curthread;
  ?>
  ...
  <tr>
    <td class="<?php print $separator ?>"> .... </td>
    <td class="<?php print $separator ?>"> .... </td>
    <td class="<?php print $separator ?>"> .... </td>
    .....
  </tr>
  ....
{/LOOP MESSAGES}

Using this construction, the class "phorum-separator" will be assigned to every new topic in the list, except for the first topic and the last topic. The class can be used to assign the <td> elements in the row a border-top for example, to add a separation line.

I hope this idea gets you some inspiration on how to modify your template.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Horizontal rule or space between threads?
September 18, 2008 10:14AM
Maurice,

Thanks for the very quick response. I’m a little obtuse (my wife will verify!) and I’m not exactly sure where in list_threads.tpl to put some of the code. I’ve put the code in a number of different spots between the <LOOP MESSAGES> and </LOOP MESSAGES> but I haven’t had the results I’m looking for.

I’ve been able to put the horizontal line separator between every post using your code but I still can’t get it to show up only between the threads. I’m not sure if I was clear in my question (sometimes these computer issue/ideas are difficult for me to describe), essentially what I’m looking to do is:


Thread1
---Re: Thread1
------Re: Thread1
---------Re: Thread1
------------Re: Thread1

____________________________________________________________


Thread2
---Re: Thread2
------Re: Thread2
---------Re: Thread2
---Re: Thread2
------Re: Thread2

____________________________________________________________


Thread3
---Re: Thread3
------Re: Thread3
---------Re: Thread3

____________________________________________________________




I assume that’s what the code you put up is designed to do but I just can’t seem to get it right.

By the way, I went to your secret sauce site and I didn’t see any examples of the ..... separator in a threaded format. Could you point me to the specific URL of the threaded page so I could check it out?

Thanks again for all your help. This support is one of the best features of phorum.


Jake Morgan

www.PULLOFF.com
Independent Pulling News
Re: Horizontal rule or space between threads?
September 18, 2008 11:04AM
Here is an alternate method which should do what you want. You will need to edit the list_threads.tpl and the css.tpl as follows:

list_threads.tpl:
replace:
    {LOOP MESSAGES}

    {IF MESSAGES->parent_id 0}
        {IF altclass ""}
            {VAR altclass "alt"}
        {ELSE}
            {VAR altclass ""}
        {/IF}
    {/IF}
with:
    <?php GLOBAL $PHORUM ?>
    
    {LOOP MESSAGES}
    
    {IF SUBSEQUENTPOSTS 1}
        {IF MESSAGES->parent_id 0}
            {IF altclass "thread"}
                {VAR altclass "alt_thread"}
            {ELSEIF altclass ""}
                {VAR altclass "alt_thread"}
            {ELSE}
                {VAR altclass "thread"}
            {/IF}
        {ELSE}
            {IF altclass "alt_thread"}
                {VAR altclass "alt"}
            {ELSEIF altclass "thread"}
                {VAR altclass ""}
            {/IF}
        {/IF}
    {ELSE}
        {VAR altclass ""}
    {/IF}

    <?php if(empty($PHORUM["DATA"]["SUBSEQUENTPOSTS"])) $PHORUM["DATA"]["SUBSEQUENTPOSTS"] = 1; ?>

css.tpl:
add these lines:
#phorum table.list td.alt_thread {
    background-color: {alt_background_color};
    border-top: 5px solid {border_color};
}

#phorum table.list td.thread {
    border-top: 5px solid {border_color};
}

This will give you a solid border at the top of each starting thread except for the first one.


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald




Edited 1 time(s). Last edit at 09/18/2008 11:53AM by Azumandias.


Re: Horizontal rule or space between threads?
September 23, 2008 10:35AM
Thanks for the great solutions. for some reason they changes don't show up on my site but I think it's a template isssue. I built my template using an older template and I think it's time I start with the Emerald template and make the modifications I need. Thank for the help, I'll let you know how things go once I get my site retemplated.

Thanks again.


Jake Morgan

www.PULLOFF.com
Independent Pulling News
Re: Horizontal rule or space between threads?
October 23, 2008 01:52PM
I just wanted to say thanks for the great tips. I finally started working on a new template (Emerald based this time) and I used Azumandias solution and it worked great. I can’t say enough about the help and the support on Phorum. Thank again to both Azumandias and Maurice.
Sorry, only registered users may post in this forum.

Click here to login