cybermailer Posted May 1, 2008 Share Posted May 1, 2008 Hello, i've a little problem on php...this is my code: $class = ($cid == 76) ? 'CatLevel2g' : ($cid == 75) ? 'CatLevel2r' : "$MainStyle$SubMenue"; $categories_string .= "$Pre$Tabulator<li class='$class'><a $Aktiv href='" . xtc_href_link(FILENAME_DEFAULT, xtc_category_link($cid, $foo[$cid]['name'])) . "'>" . $foo[$cid]['name'] . "$ProductsCount</a>\n"; cid = category id = e.g. APPLE or BANANA CatLevel2 = Styleheet the Catlevel2(g) stands for GREEN and CatLevel2® stands for RED. Now my problem ist that i want to color two categories manually. But the color would always be the color coded at last. So both category are now in red. If i change the code in $class = ($cid == 76) ? 'CatLevel2r' : ($cid == 75) ? 'CatLevel2g' : "$MainStyle$SubMenue"; the categories would be green. How must the php code be to work fine? thx Link to comment https://forums.phpfreaks.com/topic/103733-i-have-a-small-problem-with-category-colours/ Share on other sites More sharing options...
moselkady Posted May 1, 2008 Share Posted May 1, 2008 Add another pair of parenthesis around the second condition $class = ($cid == 76) ? 'CatLevel2r' : (($cid == 75) ? 'CatLevel2g' : "$MainStyle$SubMenue"); Link to comment https://forums.phpfreaks.com/topic/103733-i-have-a-small-problem-with-category-colours/#findComment-531155 Share on other sites More sharing options...
cybermailer Posted May 1, 2008 Author Share Posted May 1, 2008 fine it works... and how must it be if i want it for 4 times like $class = ($cid == 76) ? 'CatLevel2r' : (($cid == 75) ? 'CatLevel2g' : "$MainStyle$SubMenue"); + PLUS thisk ($cid == 74) ? 'CatLevel2y' ($cid == 73) ? 'CatLevel2b' thank you for your help Link to comment https://forums.phpfreaks.com/topic/103733-i-have-a-small-problem-with-category-colours/#findComment-531192 Share on other sites More sharing options...
moselkady Posted May 1, 2008 Share Posted May 1, 2008 $class = ($cid == 76) ? 'CatLevel2r' : (($cid == 75) ? 'CatLevel2g' : (($cid == 74) ? 'CatLevel2y' : (($cid == 73) ? 'CatLevel2b' : "$MainStyle$SubMenue"))); Link to comment https://forums.phpfreaks.com/topic/103733-i-have-a-small-problem-with-category-colours/#findComment-531198 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.