Difference between revisions of "List-Cat.php"

From Organic Design wiki
(Change to plain list (no columns))
(newline problem)
Line 4: Line 4:
 
$cl = $db->tableName( 'categorylinks' );
 
$cl = $db->tableName( 'categorylinks' );
 
xwGetProperty( $properties, 'list-cat', $cat );
 
xwGetProperty( $properties, 'list-cat', $cat );
 +
$article = trim( $article )."\n";
 
$result = $db->query( "SELECT cl_sortkey FROM $cl WHERE cl_to = '$cat'" );
 
$result = $db->query( "SELECT cl_sortkey FROM $cl WHERE cl_to = '$cat'" );
 
while ( $row = mysql_fetch_assoc($result) )
 
while ( $row = mysql_fetch_assoc($result) )
 
$article .= "*[[".str_replace('_', ' ', $row['cl_sortkey'])."]]\n";
 
$article .= "*[[".str_replace('_', ' ', $row['cl_sortkey'])."]]\n";
 
?>
 
?>

Revision as of 07:12, 14 January 2006

<?

  1. Append article content with a list of article-names from category specified in properties

$db =& wfGetDB( DB_SLAVE ); $cl = $db->tableName( 'categorylinks' ); xwGetProperty( $properties, 'list-cat', $cat ); $article = trim( $article )."\n"; $result = $db->query( "SELECT cl_sortkey FROM $cl WHERE cl_to = '$cat'" ); while ( $row = mysql_fetch_assoc($result) ) $article .= "*[[".str_replace('_', ' ', $row['cl_sortkey'])."]]\n"; ?>