yakabod Posted September 18, 2007 Share Posted September 18, 2007 http://caraudioclips.com/category.php On the left side is a list of categories. I want like 2 or 3 of those categories to be bolded or different font color. How would I go about in achieving this? Would I need to use conditionals as my solution? If there is a certain code I should show you guys, I'll be happy to provide it for you. Thanks alot! Quote Link to comment https://forums.phpfreaks.com/topic/69802-if-conditionals-solution/ Share on other sites More sharing options...
AdRock Posted September 18, 2007 Share Posted September 18, 2007 Sounds like you need to adjust the stylesheet or just edit the style for those particular links. Have you got some code we could see? Quote Link to comment https://forums.phpfreaks.com/topic/69802-if-conditionals-solution/#findComment-350670 Share on other sites More sharing options...
freakstyle Posted September 18, 2007 Share Posted September 18, 2007 how you implement depends on why a specific item should be bolded. is it for only specific names ( Alpine, JBL, Kenwood) or is there a specific type ( would be defined in a db, or array of those nav items ) once you know why each one is different, you're pretty much halfway there. lets assume your list is at some point in an array, and you are looping over each item and creating some sort of html string for output later on.... <?php $ArrayToBold = array('Alpine', 'JBL', 'Kenwood' ) ; $ArrayOfNavItems = ('Alpine', 'JBL', 'Kenwood' , 'Cerwin Vega') ; $Html = null; if ( is_array($ArrayOfNavItems) ) : foreach ( $ArrayOfNavItems as $item ) : if ( in_array($item, $ArrayToBold) ) : $Html = '<li><a href="/category_home.php?cid=' . $item . '" class="Bold_ItemLink">' . $item . '</a></li>' . "\r\n" ; else : $Html = '<li><a href="/category_home.php?cid=' . $item . '" class="ItemLink">' . $item . '</a></li>' . "\r\n" ; endif ; endforeach ; endif ; ?> <ul> <?php echo $Html; ?> </ul> hope this helps and good luck Quote Link to comment https://forums.phpfreaks.com/topic/69802-if-conditionals-solution/#findComment-350684 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.