You are here:  » search results format

Support Forum



search results format

Submitted by wilkins on Wed, 2007-06-20 22:31 in

hi

I have been trying to get each result into an individual table and for each result to have alternate colours ie first blue second yellow third blue etc. without success. Is tis possible do you think as it would be a great way to distinguish each result.

Brent

Submitted by support on Thu, 2007-06-21 06:02

Hi Brent,

The usual way to create alternate colours is to have 2 separate styles defined in your style sheet, and then use a counter that is incremented as each row (or individual table) is displayed, and an appropriate style chosen depending upon whether the counter is odd or even.

For example, in your default.css, create the following styles:

.o { background-color: #EEEEEE; }
.e { background-color: #DDDDDD; }

Each row of the search results is started by the following HTML in html/searchresults.php (line 7):

      <tr>

To replace this to give alternating coloured rows, try something like this:

<?php
    $rowcounter
++;
    if (
$rowcounter 2)
    {
      print 
"<tr class='o'>";
    }
    else
    {
      print 
"<tr class='e'>";
    }
?>

Hope this helps!
Cheers,
David.