1
0

Clean up tag display logic

This commit is contained in:
Bharat Mediratta 2009-12-24 11:07:03 -08:00
parent 9a1fc57211
commit 1ed3c46997

View File

@ -32,24 +32,20 @@
<? endif ?> <? endif ?>
<? if (module::is_active("tag")): ?> <? if (module::is_active("tag")): ?>
<? <? $tags = ORM::factory("tag")
$tagsItem = 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)): ?>
<li> <li>
<strong class="caption"><?= t("Tags:") ?></strong> <strong class="caption"><?= t("Tags:") ?></strong>
<? for ($counter=0; $counter<count($tagsItem); $counter++) { ?> <? $not_first = 0; ?>
<? if ($counter < count($tagsItem)-1) { ?> <? foreach ($tags as $tag): ?>
<a href="<?= url::site("tags/$tagsItem[$counter]") ?>"><?= html::clean($tagsItem[$counter]->name) ?></a>, <?= ($not_first++) ? "," : "" ?>
<? } else {?> <a href="<?= url::site("tags/{$tag->name}") ?>"><?= html::clean($tag->name) ?></a>
<a href="<?= url::site("tags/$tagsItem[$counter]") ?>"><?= html::clean($tagsItem[$counter]->name) ?></a> <? endforeach ?>
<? } ?> </li>
<? } ?> <? endif ?>
</li>
<? endif ?>
<? endif ?> <? endif ?>
</ul> </ul>