Technology Weblogging

Month, day, year, oh my

Another fooflah, this time over archiving.

Dorothea picked on Mark’s archive setup, which is based on archive-month-link. Jonathon responds with a push-back at Dorothea’s weekly archive. He’s joined in his comments by Mark who pushes back with justification for his archive-month-link. Aquarionics bravely joines the discussion, Dorothea retracts.

Could be me misreading everything but it sure looked like good fun was NOT had by all. Good lord, I thought I was the only person who took things too seriously.

Being the pain in the butt, annoyance, and general irritant that I am, I thought I would make things worse. It’s part of my philosophy that if you push things enough, either it blows totally, in which case we’ll at least have an interesting afternoon; or everyone collapses into laughter, poking gentle fun at each other’s font choice.

In line with this, I take a great deal of satisfaction in knowing that everyone would be uncomfortable with my archive setup. I list categories, the last 50 entries, and I provide search. That’s it. No weekly or monthly archives at all. I never really thought anyone used them. From this discussion, though, I think I may be off in my assessment; perhaps people do use archives. Well, this is a lowering thought. All this time I’ve been depriving my readers of my archives.

However, after reading all this, I wasn’t sure how to do archives. No matter what kind of archive I implemented, I would be taking sides, and that kind of ruins some of the fun. But I didn’t want to do all of the archives, as static web page generation is taking far too long now as it is. So I did what any self-respecting blogger would do: I picked door number 3.

Instead of static archive pages, I added a form to my main Archive page just under the categories. A person puts in a specific date (using a specific format), picks if they want the material ordered reverse chronological, and clicks the button. A MySql/PHP page opens that lists all of the content in either chronological (default) or reverse order. They can then click on an item to go the main page to view the trackbacks and comments, or they can just read the material there (though I might change this).

Because I let MT do my line breaks I had to a little tiny munging on the text, but that’s my own fault for not doing my own markup.

If a person screws up the format, they’ll get all of my material dating back to when I did my last port in March of last year (I didn’t move all my old content over). However, I also put a limit of only 300 entries on the page. I might play with this a bit, add a range later, but we’ll see how it goes for now.

Following is the code — change stuff appropriately.


$dt = $_POST[‘create_date’];
$reverse = $_POST[‘reverse’];

if ($reverse)
$order = “ORDER BY entry_created_on desc limit 300”;
$order = “ORDER BY entry_created_on limit 300”;

$link = mysql_connect(“localhost”, “user”, “password”)
or die(“database errors”);
mysql_select_db (“database”);

$query = “SELECT entry_id, entry_title, entry_text, entry_created_on FROM mt_entry where entry_created_on > ‘” . $dt . “‘ and entry_blog_id = 2 and entry_status = 2 ” . $order;

$result = mysql_query($query) or die(“database errors”);

while ($line = mysql_fetch_array($result, MYSQL_NUM)) {
$input = $line[0];
$input = str_pad($input, 6, “0”, STR_PAD_LEFT);

$text = str_replace(“</blockquote><br />”, “</blockquote>”, str_replace(“<blockquote><br />”, “<blockquote>”,nl2br($line[2])));

printf(“<div class=’titlebox’><span class=’title’>”);

printf(“<a href=’’>%s</a></span></div>”, $input, $line[1]);

printf(“<div class=’blogbody’ style=’font-family: arial; font-size: 12px; line-height: 16px’>%s<div class=’posted’><p>Posted on %s</p></div>”,
$text, $line[3]);

/* Free resultset */

/* Closing connection */


Print Friendly, PDF & Email