MovableBlog: Links Divided Over 2 Columns
December 4, 2002
On the Vancouver Webloggers links page, the links are alphabetized and divided into a two columns. But how?!
With PHP of course.
Place in your index template somewhere this code. I have a whole blog in MT dedicated to links, and in the case of Vancouver Webloggers, use the category "Other" for bloggers other than the authors of the site.
$links = array();
<MTEntries category="Other" sort_order="ascend" sort_by="title">
$links = "<$MTEntryBody encode_php="qq"$>";
Then, where you want the links to appear in two columns, insert this code:
$half = $numlinks/2;
$half = (int) $half;
for ($i = 0;$i < $half; $i++)
print $links[$i]."<br />\n";
for ($y = $half; $y < $numlinks;$y++)
print $links[$y]."<br />\n";
Note that for the title of each link's entry, I take the blog name and capitalize the first letter. Also, I follow the practice of not using "A" or "The" as the first word in the title. So "The Blog That Never Was" is inserted in the the title as "Blog That Never Was, The" and "a blog through time" becomes "Blog through time, A".