set up a title archive list (MT specific)
Michael over at DrowsyCentral asked me how I set up my title archive list. He also wanted to know how to set up the page so that it showed the posts for just ONE particular month…
First, here’s the code that writes all the titles
<?
$j = “”;
?>
<p>
<MTArchiveList>
<?
$i = “<$MTArchiveDate format=”%B %e, %Y”$>”;
if (!strcasecmp($i, $j)) {
//do nothing
} else {
print(’</p><p><$MTArchiveDate format=”%B %e, %Y”$><br>’);
}
$j = “<$MTArchiveDate format=”%B %e, %Y”$>”;
?>
<MTEntries>
<a href=”<$MTArchiveLink$>”><$MTArchiveDate format=”%l:%M %p”$>:</a> <i><$MTEntryTitle$></i><br>
</MTEntries>
</MTArchiveList>
Now here’s the fun part. The script below will write a page that lists all the months you have archives for. You click on the month, and it will reload the page and list just the entries for that month:
<?
if (isset($showmonth)) {
$j = “”;
?>
<p>
<MTArchiveList>
<?
$thismonth = “<$MTArchiveDate format=”%B”$>”;
$thisyear = “<$MTArchiveDate format=”%Y”$>”;
if ((!strcasecmp($showmonth, $thismonth)) && (!strcasecmp($showyear, $thisyear)) ) {
$i = “<$MTArchiveDate format=”%B %e, %Y”$>”;
if (!strcasecmp($i, $j)) {
//do nothing
} else {
print(’</p><p><$MTArchiveDate format=”%B %e, %Y”$><br>’);
}
$j = “<$MTArchiveDate format=”%B %e, %Y”$>”;
?>
<MTEntries>
<a href=”<$MTArchiveLink$>”><$MTArchiveDate format=”%l:%M %p”$>:</a> <i><$MTEntryTitle$></i><br>
</MTEntries>
<? } ?>
</MTArchiveList>
<? } ?>
<MTArchiveList archive_type=”Monthly”>
<a href=”<? echo $PHP_SELF ?>?showmonth=<$MTArchiveDate format=”%B”$>&showyear=<$MTArchiveDate format=”%Y”$>”><$MTArchiveDate format=”%B %Y”$></a><br>
</MTArchiveList>
keep in mind, these scipts are pretty much cut and paste - the only thing you need to add is any styling you want…
May 25th, 2002 at 1:32 am
This isn’t related to this entry, but I was wondering about the link to your 50 last referers. Is this something I can do in PHP? Big time novice over here.
May 25th, 2002 at 5:31 am
Carla - Yes. That is a PHP script, and you can grab it from little green footballs (scroll down on the left side bar - under scripts - “lgf referrers”)
May 26th, 2002 at 8:59 am
I guess the second part is a space saving device, as MT can easily do that with separate pages… I’m not quite sure why you’re using PHP at all though for the first part. I have my posh archives set up with day and title just like that using MT code. Am I missing something?
May 26th, 2002 at 9:05 am
If you have your date-based archive set up to just show date and title, then no, this won’t be useful. However, I have my date-based archive set up to show all the entries (including the actual post, etc) in the date based archive.
If you just want to see a list of titles of posts (not the whole post) just for a month at a time - then this is what this script would be useful for.
If you have another way, feel free to post it.
May 26th, 2002 at 9:10 am
that is - if you want to have the title and date just for the month - but still also also have the month archives set up as I do…
I guess you could do this with custom archive templates - Lynda, feel free to post a tutorial on it. This script was written before the latest version of MT which allows for that.
July 5th, 2002 at 9:26 pm
I have to admit that this confused me too. I’ve only been using MT for about two weeks and have (finally) got it to do this for me too.
I use monthly and individual archives to do it, the master archive contains the list of months, the monthly archives contain the list of entry titles, with their date. They link to the individual entry archives.
July 24th, 2002 at 12:37 am
Jennifer-
I’ve been using part of this for a while now and love it. I was planning to start using the entire thing like [EDITED] your site, but was wondering if there was a way to integrate the code from the collapsing comments & extended entries so that the page isn’t being refreshed, just the desired parts expanded and collapsed.
March 31st, 2003 at 1:19 pm
Discovered lgf a couple of days ago. I have mentioned your site on ebiblio.com. I am wondering since this page came up if you know if the search requests script lgf-search-requests.php is also available like the referrers script at lgf.
I am experimenting with some referral scripts with search engine at orggy.com and wonder what you would recommend as a source for global, site wide referrals scripts in general.
March 31st, 2003 at 1:24 pm
Forest - lgf-search referral script is here.