"Drupal相关文章代码"
Published on Aug. 22, 2023, 12:06 p.m.
基于tags实现 放入node.tpl.php
<div class=”sapp”>
<h2 class=”sapptitle”>SIMILAR entity</h2>
<ul class=”sapplist”>
<?php
foreach ($node->field_tags[‘und’] as $record) {
$result = db_query(“SELECT entity_id
FROM {field_data_field_tags}
WHERE field_tags_tid =$record[tid]
ORDER BY entity_id DESC
LIMIT 0 , 10”);
foreach ($result as $record) {
$snode=node_load($record->entity_id);
$options = array(‘absolute’ => TRUE);
$url = url(‘node/’ . $record->entity_id, $options);
print ‘<li class=”lapplist”>
<a href=”’.$url.’“> <span class=”devname”>’.$snode->title.’</span></a>
</li>’;
$snode=NULL;
}
}
?>
</ul>
</div>