4images Forum & Community

General / Allgemeines => Programming => Topic started by: .Infecto on March 14, 2016, 07:25:34 PM

Title: rows (first / row / last) - How to Add the First and Last Class
Post by: .Infecto on March 14, 2016, 07:25:34 PM
Hallo zusammen,

wie bewerkstellige ich es, das ich das erste row immer mit class="item-first" füllen kann?

  while ($image_row = $site_db->fetch_array($result)){
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $new_images .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $new_images .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

    show_image($image_row);
    $new_images .= $site_template->parse_template("thumbnail_bit");
    $new_images .= "\n</td>\n";
    $count++;
    if ($count == $config['image_cells']) {
      $new_images .= "</tr>\n";
      $count = 0;
    }
  } // end while

Erste row immer "item-first"
Zweite row "item"
Und das letzte row immer "item-last"

Wie geht das? Hat da jemand eine Idee und kann mir da abhelfen?

VG
Title: Re: rows (first / row / last) - How to Add the First and Last Class
Post by: Sunny C. on March 26, 2016, 12:41:40 AM
Du kannst hier ganz bequem mit CSS arbeiten: first & last
http://maddesigns.de/last-child-first-child-selektoren-css3-adventskalender-tag-11-514.html

LG