Page 1 of 1

How to sort date from newest to oldest?

Posted: Tue Jan 14, 2014 12:28 am
by mutzii
Hi Guys!

I've been trying to find a solution on how to sort the blog posts of my website from newest to oldest. The blog couldn't be found in the data base as I think it was created independently.

Here's the code in the backend:

Code: Select all

<?php 
				//print '<pre>'.print_r($content_list, true).'</pre>';
				print '<ul class="blog-list">';
				foreach ($content_list as $blog_entry){
					print '<li>';
					print '<div class="blog-image"><a href="blog.php?cname='.$blog_entry['name'].'" title="'.$blog_entry['title'].'">'.$blog_entry['image'].'</a></div>';
					print '<h3 class="blog-title"><a href="blog.php?cname='.$blog_entry['name'].'" title="'.$blog_entry['title'].'">'.$blog_entry['title'].'</a></h3>';
					print '<span class="blog-date">'.date('F d, Y', strtotime($blog_entry['date'])).'</span>';
					print '</li>';
				}
			?>
		<?php } else { ?>
Should I just add something in here?? I duno much about PHP.

Re: How to sort date from newest to oldest?

Posted: Tue Jan 14, 2014 7:44 am
by Celauran
mutzii wrote:The blog couldn't be found in the data base
Is it stored in a flat file then? Where is $content_list coming from?