JSHINER Posted March 23, 2007 Share Posted March 23, 2007 I have the following: foreach ($page['events'] as $z) { echo '<b>', $z['date'], '</b> - ', '<a href="', $z['link'], '">', htmlentities($z['title']), '</a> </br>', htmlentities(stripslashes($z['description'])), '</p>'; } Which displays: 2007-03-23 - Title... 2007-03-23 - Title 2.... 2007-03-24 - Title ... etc... But I want it to display as: 2007-03-23 2007-03-23 - Title 2007-03-23 - Title 2 2007-03-24 2007-03-24 Title Link to comment https://forums.phpfreaks.com/topic/43978-solved-splitting-up-dates/ Share on other sites More sharing options...
obsidian Posted March 23, 2007 Share Posted March 23, 2007 Just output a '<br />' tag wherever you want the line breaks to appear. Link to comment https://forums.phpfreaks.com/topic/43978-solved-splitting-up-dates/#findComment-213532 Share on other sites More sharing options...
Lumio Posted March 23, 2007 Share Posted March 23, 2007 No I think he wanted to viel all events of one day. Try that one: <?php foreach ($page['events'] as $a) { if (!isset($events[$a['date']])) $events[$a['date']] = array(); $events[$a['date']][] = $a; } foreach ($events as $i => $a) { echo "<b>$i</b><br />\n"; foreach ($a as $z) { echo '<b>', $z['date'], '</b> - ', '<a href="', $z['link'], '">', htmlentities($z['title']), '</a> </br>', htmlentities(stripslashes($z['description'])), '</p>'; } } ?> Link to comment https://forums.phpfreaks.com/topic/43978-solved-splitting-up-dates/#findComment-213537 Share on other sites More sharing options...
JSHINER Posted March 23, 2007 Author Share Posted March 23, 2007 That's it - thank you ! Link to comment https://forums.phpfreaks.com/topic/43978-solved-splitting-up-dates/#findComment-213548 Share on other sites More sharing options...
Lumio Posted March 23, 2007 Share Posted March 23, 2007 You're welcome Link to comment https://forums.phpfreaks.com/topic/43978-solved-splitting-up-dates/#findComment-213560 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.