List-Cat.php
From Organic Design wiki
<?
- Append article content with items from category specified in properties - 2005-10-10
$db =& wfGetDB(DB_SLAVE); $cl = $db->tableName('categorylinks'); xwGetProperty($properties, 'list-cat', $cat); $result = $db->query("SELECT cl_sortkey FROM $cl WHERE cl_to = '$cat'"); $items = array(); $i = 0; while ($row = mysql_fetch_assoc($result)) $items[++$i%3][] = $row['cl_sortkey'];
$article .= "\n
"; foreach ($items as $row) { $article .= "\n";
foreach ($row as $i) $article .= "*".str_replace('_', ' ', $i)."\n"; } $article .= " |
\n";
?>