ERLEDIGT
JA
JA
ANTWORTEN
5
5
ZUGRIFFE
203
203
EMPFEHLEN
-
Hallo Leute,
habe ein kleines Problem bei welchem ich auf Hilfe angewisen bin.
Ich habe eine Schleife:
Nun möchte ich jedes zweite Ergebniss farblich hervorheben.PHP-Code:$row = 0;
$col = 0;
$info_box_contents = array();
while ($family = tep_db_fetch_array($art_groesse_all_query)) {
$family['products_name'] = tep_get_products_name($family['products_id']);
?>
<tr>
<td width="20%" align="center" class="smalltext"><?= $family['products_name'] ?></td>
<td width="20%" align="center" class="smalltext"><?php
if ($family['products_quantity'] > 0)
echo $lc_text = tep_image(DIR_WS_IMAGES . 'icon_status_green3.gif',LIEFERBAR, 31,14); else
echo $lc_text = tep_image(DIR_WS_IMAGES . 'icon_status_red3.gif',ARTIKEL_VERGRIFFEN, 31,14); ?></td>
<td width="20%" align="center" class="smalltext"><?= $family['products_model'] ?></td>
<td width="20%" align="center" class="smalltext"><font><b><? if($family['specials_new_products_price'] > '0'){
echo $currencies->display_price_nodiscount($family['specials_new_products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
}else{
echo $currencies->display_price($family['products_id'],$family['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
} ?></b></font></td>
<td width="20%" align="center" class="smalltext"><?php echo tep_draw_checkbox_field('add_recommended[]',$family['products_id']); ?></td>
</tr>
<?php
$col ++;
if ($col > 0) {
$col = 0;
$row ++;
}
}
}
Eigentlich NULL Problemo. Allerdings habe ich so meine Schwierigkeiten jede zweite Abfrage mit einer Variable zu definieren.
Versteht Ihr was ich meine?.
Wäre dankbar für Unterstützung.
Danke und Gruss
-
Versuch es mal so
mach doch davor eine variable z.B. $farbe = 1;
und dann in der schleife $color = ($farbe) ? "#CCCCCC" : "#FFFFFF"; danach noch ein $farbe *= -1;
dann einfach bei bgcolor oder was auch immer echo $color rein.
das sollte so gehen
-
Hi und Danke für die Hilfe.
Jedoch werden nun alle grau angezeigt.
Ich hab das mal testweise so gemacht:
Vielleicht hab ich einen Fehler gemacht?!PHP-Code:<?php
if ($art_groesse_new_split->number_of_rows > 0) {
$art_groesse_all_query = tep_db_query($art_groesse_new_split->sql_query);
$row = 0;
$col = 0;
$farbe = 1;
$info_box_contents = array();
$template['produkt_varianten'] .= '<table border="0" cellspacing="0" cellpadding="0" width="100%">';
while ($family = tep_db_fetch_array($art_groesse_all_query)) {
$color = ($farbe) ? "#CCCCCC" : "#FFFFFF";
$farbe *= -1;
$family['products_name'] = tep_get_products_name($family['products_id']);
$template['produkt_varianten'] .= '<tr>
<td width="20%" align="center" class="smalltext">'.$family['products_name'].' </td>
<td width="20%" align="center" class="smalltext">';
if ($family['products_quantity'] > 0)
$template['produkt_varianten'] .= $lc_text = tep_image(DIR_WS_IMAGES . 'icon_status_green3.gif',LIEFERBAR, 31,14); else
$template['produkt_varianten'] .= $lc_text = tep_image(DIR_WS_IMAGES . 'icon_status_red3.gif',ARTIKEL_VERGRIFFEN, 31,14);
$template['produkt_varianten'] .= '</td>
<td width="20%" align="center" class="smalltext" bgcolor="'.$color.'">'.$family['products_model'].'</td>
<td width="20%" align="center" class="smalltext"><font><b>';
if($family['specials_new_products_price'] > '0'){
$template['produkt_varianten'] .= $currencies->display_price_nodiscount($family['specials_new_products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
}else{
$template['produkt_varianten'] .= $currencies->display_price($family['products_id'],$family['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
}
$template['produkt_varianten'] .= ' </b></font></td> <td width="20%" align="center" class="smalltext">'.tep_draw_checkbox_field('add_recommended[]',$family['products_id']).' </td>
</tr>';
?>
<?php
$col ++;
if ($col > 0) {
$col = 0;
$row ++;
}
}
$template['produkt_varianten'] .= '</table>';
}
?>
Gruss
-
$color = ($farbe) ? "#CCCCCC" : "#FFFFFF"; mach daraus mal $color = ($farbe == 1) ? "#CCCCCC" : "#FFFFFF"; dann geht es
-
Jawollja!
Es funktioniert so.
Ich danke Dir
Gruss
-
Kein Problem, immer wieder gerne
Ähnliche Themen
-
Generics - Rückgabewert einer generischen Methode als Parameter einer Zweiten
Von DarthShader im Forum JavaAntworten: 3Letzter Beitrag: 06.07.08, 23:54 -
Sortierung in der zweiten schleife (MYSQL /PHP)
Von fRagiLeMOD im Forum PHPAntworten: 3Letzter Beitrag: 15.05.07, 20:15 -
Animationen bei mehrmaligem aufrufen einer Folie jedes mal anzeigen
Von Felidae im Forum Microsoft WindowsAntworten: 1Letzter Beitrag: 25.01.06, 17:49 -
Einbau einer zweiten Festplatte
Von guhumueller im Forum Microsoft WindowsAntworten: 2Letzter Beitrag: 05.12.04, 09:47 -
Hilfe bei der Bestimmung einer alten Kamera
Von Dunsti im Forum Fotografie & DigitalfotografieAntworten: 6Letzter Beitrag: 14.08.02, 00:54





Zitieren
Login






[PHP][Snippet] Array zu XML konvertieren