Mainlining quick links with MTPerlScript and MTOtherBlog

Now I'm on the main-column microcontent bandwagon. I'm sure you can adapt this technique to PHP, but... well.

<MTPerlScript> my @entries; <MTEntries lastn="5"> push @entries, ['<MTEntryDate format="%Y%m%d%H%M%S">', 'main', <<'ENDOFENTRY']; <MTInclude module="Entry" smarty_pants="1"> ENDOFENTRY </MTEntries> <MTOtherBlog blog_name="markpasc.org quick links"><MTEntries lastn="10"> push @entries, ['<MTEntryDate format="%Y%m%d%H%M%S">', 'quick', <<'ENDOFENTRY']; <MTInclude module="Entry" smarty_pants="1"> ENDOFENTRY </MTEntries></MTOtherBlog> # Sort by date. @entries = sort { $b->[0] <=> $a->[0] } @entries; my $printingLinks = 0; # 1 if the <ul> is open sub printEntry { # We wouldn't normally need the indirection; maybe # that's something weird with MTPerlScript? my ($e, $printingLinks) = @_; if($e->[1] eq 'quick' && !$$printingLinks) { $$printingLinks = 1; print qq(<ul class="quick">\n); } elsif($e->[1] ne 'quick' && $$printingLinks) { $$printingLinks = 0; print '</ul>'; } print $e->[2]; } printEntry($_, \$printingLinks) for @entries; # Close the list if it's still open. print '</ul>' if $printingLinks; </MTPerlScript>

Note MTOtherBlog will grab the quick links weblog's Entry template module for those entries. As it's the body of the <ul/>, that Entry module is an <li/>.