![]() |
Style output of multidimensional array - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Style output of multidimensional array (/showthread.php?tid=51649) |
Style output of multidimensional array - El Forum - 05-11-2012 [eluser]BigBonsai[/eluser] Hello there. Here is one I have trouble figuring out. ![]() To make this an easy example I have the following table of cars: ID: 1 Brand: Volkswagen Color: Yellow ID: 2 BRAND: BMW Color: Blue Say I put this in a multidimensional array like this (coming out of a database, processed by a foreach loop): Code: $cars[$row->car_id]['brand'] = $row->car_brand; This I output with a simple ul($cars), which comes with the html helper. The output will look something like this: Code: <ul> This works perfect, BUT: What if I do not want to display the ID? Or what if I want to display different colors for each list point of colors or or or? Point is - is there a way to give the different list points style information like class or id? So something like this would be brilliant: Code: <ul id="cars"> I hope I made this halfway understandable. ![]() Thanks for your input. ![]() BiB |