PDA

View Full Version : The REAL fix for fancyarchives


witty
03-30-2007, 03:47 PM
Hi,

Seems people were having a problem with the archives not working when the year changed (which for me, was when 2006 became 2007). The solution posted in another thread was to replace "%m %d %Y" with "%Y%m%d" (without the quotes) in the fancyarchive.php file. Well, that may "work", but it makes for a pretty ugly date format on your archive page. Instead of:

Mar 26, 2007

after the "fix", it would display as:

Mar26,2007

The problem goes a bit deeper than the suggested "fix". To really clean it up requires changing the following lines in your fancyarchive.php file (the line numbers may vary from what I have):

Line 138, find:

$where = " WHERE $where_date AND DATE_FORMAT(b.datetime, '%m %d %Y') <= DATE_FORMAT(CURDATE(),'%m %d %Y') ";

and replace with:

$where = " WHERE $where_date AND b.datetime <= CURDATE() ";


Line 142, find:

$where = " WHERE DATE_FORMAT(b.datetime, '%m %d %Y') <= DATE_FORMAT(CURDATE(),'%m %d %Y') ";

and replace with:

$where = " WHERE b.datetime <= CURDATE() ";


Line 150, find:

WHERE b.image_id = a.id AND c.id = b.cat_id AND DATE_FORMAT(a.datetime, '%m %d %Y') <= DATE_FORMAT(CURDATE(),'%m %d %Y') GROUP BY c.id, c.name order by 2");

and replace with:

WHERE b.image_id = a.id AND c.id = b.cat_id AND a.datetime <= CURDATE() GROUP BY c.id, c.name order by 2");


Line 180, find:

WHERE DATE_FORMAT(a.datetime, '%m %d %Y') <= DATE_FORMAT(CURDATE(),'%m %d %Y')

and replace with:

WHERE a.datetime <= CURDATE()


Line 241, find:

date_format(b.datetime,'%b %e, %Y')

and replace with:

b.datetime


Line 300, find:

date_format(b.datetime,'%b %e, %Y')

and replace with:

b.datetime


As always, you should make a backup of the fancyarchive file just in case.


-Witty

dakwegmo
03-30-2007, 03:56 PM
With so many changes it might be helpful to just upload the file somewhere.

witty
03-30-2007, 04:04 PM
With so many changes it might be helpful to just upload the file somewhere.

The first 4 lines that need to be changed (138, 142, 150, and 180) are the same lines everyone changed in the original "fix". The changes in lines 241 and 300 are the only additional changes I'm providing. All of the changes that I'm suggesting require you only to remove excess code... no additions of any kind.


-Witty