scriptygoddess RSS Feed
 
 
 
 

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…

9 Responses to “set up a title archive list (MT specific)”

  1. 1
    Carla:

    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.

  2. 2
    Jennifer:

    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")

  3. 3
    Lynda:

    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?

  4. 4
    Jennifer:

    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.

  5. 5
    Jennifer:

    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.

  6. 6
    Melanie:

    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.

  7. 7
    Cis:

    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.

  8. 8
    Forest:

    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.

  9. 9
    Jennifer:

    Forest - lgf-search referral script is here.

Bookmarks

WordPress Resources

Meta