![]() |
Craigslist style orderby Date - 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: Craigslist style orderby Date (/showthread.php?tid=14958) |
Craigslist style orderby Date - El Forum - 01-21-2009 [eluser]mikeyhell[/eluser] Hi All, I'm stuck on a problem and was looking for some insight. I know the solution is simple, but I can't seem to get this working. I'm returning the following to my view: Code: function get_all() But I am trying to get headings i.e. ==================== Monday June 10th entry 1 entry 2 entry 3 Tuesday June 11th entry 1 entry 2 entry 3 ==================== Thanks Craigslist style orderby Date - El Forum - 01-21-2009 [eluser]Michael Wales[/eluser] In your view: Code: <?php Craigslist style orderby Date - El Forum - 01-21-2009 [eluser]mikeyhell[/eluser] thanks, was racking my brain for no reason. Craigslist style orderby Date - El Forum - 01-30-2009 [eluser]hyperfire[/eluser] thats a great solution, but what would be the solution to show 'empty' dates when no records for a specific date is not found? Something like: 2009-01-29 - record 1 - record 2 2009-01-30 no records available 2009-01-31 - record 1 - record 2 .... and so on Craigslist style orderby Date - El Forum - 01-30-2009 [eluser]obiron2[/eluser] Create a new array for all your dates $datesarray() on change of date in the data array, move the $datesarray pointer and compare the value to the next record in the data array. If they do not match, output the $datearray() value and 'no entries' repeat until the data array date matches the $datearray() date. Obiron Craigslist style orderby Date - El Forum - 01-30-2009 [eluser]hyperfire[/eluser] I like the idea, but I don't know how to compare a value to the 'next record' inside a foreach loop. Is that possible? |