Clean up tag display logic.
This commit is contained in:
parent
bcc0a1e836
commit
f522643d70
@ -28,21 +28,18 @@ class rwinfo_theme_Core {
|
|||||||
|
|
||||||
// rWatcher Edit: Display Tags
|
// rWatcher Edit: Display Tags
|
||||||
if (module::is_active("tag")) {
|
if (module::is_active("tag")) {
|
||||||
$tagsItem = ORM::factory("tag")
|
$tags = ORM::factory("tag")
|
||||||
->join("items_tags", "tags.id", "items_tags.tag_id")
|
->join("items_tags", "tags.id", "items_tags.tag_id")
|
||||||
->where("items_tags.item_id", "=", $item->id)
|
->where("items_tags.item_id", "=", $item->id)
|
||||||
->find_all();
|
->find_all();
|
||||||
if (count($tagsItem) > 0) {
|
if (count($tags) > 0) {
|
||||||
$results .= "<li>";
|
$results .= "<li>";
|
||||||
$results .= t("Tags:") . " ";
|
$results .= t("Tags:") . " ";
|
||||||
for ($counter=0; $counter<count($tagsItem); $counter++) {
|
$anchors = array();
|
||||||
if ($counter < count($tagsItem)-1) {
|
foreach ($tags as $tag) {
|
||||||
$results .= "<a href=" . url::site("tags/$tagsItem[$counter]") . ">" . html::clean($tagsItem[$counter]->name) . "</a>, ";
|
$anchors[] = "<a href=" . url::site("tags/{$tag->id}") . ">" . html::clean($tag->name) . "</a>";
|
||||||
} else {
|
|
||||||
$results .= "<a href=" . url::site("tags/$tagsItem[$counter]") . ">" . html::clean($tagsItem[$counter]->name) . "</a>";
|
|
||||||
}
|
}
|
||||||
}
|
$results .= join(", ", $anchors) . "</li>";
|
||||||
$results .= "</li>";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// rWatcher End Edit
|
// rWatcher End Edit
|
||||||
|
Reference in New Issue
Block a user