Drupal PHP Block - Aktivste Blogs

Bei Drupal können eigenen Blöcke auch mit PHP Code erstellt werden (ab Version 6 muss das Modul PHP Filter aktiviert werden). Damit ist es möglich diverse Arten von Blöcken zu erstellen.

Hier mal ein Beispiel-Block, der eine Liste der Blogs ausgibt die die meisten Beiträge enthalten.

<?php

$res = db_query("SELECT COUNT(uid) as count, uid FROM {node} WHERE type = 'blog' AND status = 1 GROUP BY uid ORDER BY count DESC;");

while ($dat = db_fetch_object($res)) {
$u = user_load(array('uid' => $dat->uid));
$links[] = array('title' => $u->name. '´s Blog', 'href' => 'blog/'.$u->uid);
}

print theme('links', $links, $attributes = array('class' => 'links'));

?>

Hinweis:
Das Modul "blog" sollte aktiviert sein.

Hi, wo finde ich das Modul

Hi,
wo finde ich das Modul "PHP Filter"?
Ich vermisse in Drupal 6 die Funktion, PHP in Blöcke eingeben zu können.
Viele Grüße, Ralf

... hab's gerade

... hab's gerade gefunden.
Für alle, die genauso rumsuchen:
PHP Filter ist ein Kern-Modul für Drupal 6

Danke für den Hinweis, hat

Danke für den Hinweis, hat mir die Sucherei erspart.

Neuen Kommentar schreiben

Der Inhalt dieses Feldes wird versteckt und nicht öffentlich gezeigt.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Textual smileys will be replaced with graphical ones.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.