Biasanya kite pengen menampilkan latest node di dalam block. Snippet berikut berdasarkan kode dari sini dengan sedikit modifikasi dimana tidak menggunakan fungsi theme, melainkan langsung meng echo secara barbar
[php]
// comma separated lists of terms tid to display nodes
$terms = "47,48,49,50";
// the number of nodes to show
$count = 5;
$sql = "SELECT DISTINCT n.title, n.nid FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid in ($terms) AND n.status=1 ORDER BY n.created DESC";
$result = db_query_range(db_rewrite_sql($sql), 0, $count);
if (db_num_rows($result)) {
echo '
- ‘;
- ‘.l($node->title,$link).’
while ($node = db_fetch_object($result)) {
$link = ‘node/’.$node->nid;
echo ‘
‘;
}
echo ‘
‘;
}
?>
[/php]
kalo mau bikin link misal read more ke term tertentu bisa menggunakan
[php]
‘readmore’)); ?>
[/php]
utk detail penjelasan fungsi2 seperti l(), bisa diliat di API nya drupal
Recent Comments