Extension:ColList
From MediaWiki.org
|
ColList Release status: Beta |
|
|---|---|
| Implementation | Tag |
| Description | A way to easily put a list of short items in columns (actually, a table). |
| Author(s) | JulieC |
| Version | 1.1.0 (2007-12-13) |
| MediaWiki | 1.9.3 |
| Download | Source Code at MindCapers |
| Example | Example at MindCapers |
ColList is an extension of MediaWiki which provides an easy way to put a lot of short items into columns. The items are give in a comma separated list. A working example, documentation and source code are located at mindcapers.com.
[edit] Category list display
To display your list in the same format as the category pages with the first letter capitalized, here is the code snippet to use in place of the table creation. This code snippit assumes that your list is already alphabetized. For short lists, the sort command could be added, but for long lists it will probably be too time consuming.
$chunk = (int) (count ( $articles ) / 3); // get and display header $r = '<table width="100%"><tr valign="top">'; $prev_start_char = 'none'; // loop through the chunks for($startChunk = 0, $endChunk = $chunk, $chunkIndex = 0; $chunkIndex < 3; $chunkIndex++, $startChunk = $endChunk, $endChunk += $chunk + 1) { $r .= "<td>\n"; $atColumnTop = true; // output all articles in category for ($index = $startChunk ; $index < $endChunk && $index < count($articles); $index++ ) { // check for change of starting letter or begining of chunk if ( ($index == $startChunk) || (substr($articles[$index], 0, 1) != substr($articles[$index-1], 0, 1)) ) { if( $atColumnTop ) { $atColumnTop = false; } else { $r .= "</ul>\n"; } $cont_msg = ""; if ( substr($articles[$index], 1, 0) == $prev_start_char ) $cont_msg = ' ' . wfMsgHtml( 'listingcontinuesabbrev' ); $r .= "<h3>" . htmlspecialchars( substr($articles[$index], 1, 0) ) . "$cont_msg</h3>\n<ul>"; $prev_start_char = substr($articles[$index], 1, 0); } $r .= "<li>{$articles[$index]}</li>"; } if( !$atColumnTop ) { $r .= "</ul>\n"; } $r .= "</td>\n"; } $r .= '</tr></table>';

