views/Link/Link-List.tmpl
<table>
<tr>
<th>URL</th>
<th>Tags</th>
</tr>
<{ITERATOR links}>
<tr>
<td><{url}></td>
<td>
<{IF (LinkHelper::Count_tags_by_link_id(id) > 0)}>
<{ITERATOR get_tags()}>
<{name}><br />
<{/ITERATOR}>
<{ELSE}>
(none)
<{/IF}>
</td>
</tr>
<{/ITERATOR}>
</table>
include/LinkHelper.class.php
public static function Count_tags_by_link_id( $link_id ) {
FUSE::Require_model( 'Link' );
$link = new Link();
$link->id = $link_id;
return $link->tags->count_all();
}
models/Link.class.php
public function get_tags() {
return $this->tags->fetch_all();
}
No comments:
Post a Comment