diff options
Diffstat (limited to '')
-rw-r--r-- | include/functions_html.inc.php | 48 | ||||
-rw-r--r-- | include/section_init.inc.php | 26 |
2 files changed, 50 insertions, 24 deletions
diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php index 969bb48be..3bc9a4706 100644 --- a/include/functions_html.inc.php +++ b/include/functions_html.inc.php @@ -610,4 +610,52 @@ function page_not_found($msg, $alternate_url=null) .$msg.'</div>', 5 ); } + +/* returns the title to be displayed above thumbnails on tag page + */ +function get_tags_content_title() +{ + global $page; + $title = count($page['tags']) > 1 ? l10n('Tags') : l10n('Tag'); + $title.= ' '; + + for ($i=0; $i<count($page['tags']); $i++) + { + $title.= $i>0 ? ' + ' : ''; + + $title.= + '<a href="' + .make_index_url( + array( + 'tags' => array( $page['tags'][$i] ) + ) + ) + .'" title="' + .l10n('See pictures linked to this tag only') + .'">' + .$page['tags'][$i]['name'] + .'</a>'; + + if ( count($page['tags'])>2 ) + { + $other_tags = $page['tags']; + unset ( $other_tags[$i] ); + $title.= + '<a href="' + .make_index_url( + array( + 'tags' => $other_tags + ) + ) + .'" style="border:none;" title="' + .l10n('remove this tag') + .'"><img src="' + .get_root_url().get_themeconf('icon_dir').'/remove_s.png' + .'" alt="x" style="vertical-align:bottom;" class="button"/>' + .'</a>'; + } + + } + return $title; +} ?> diff --git a/include/section_init.inc.php b/include/section_init.inc.php index 9db071714..7e3f87cfe 100644 --- a/include/section_init.inc.php +++ b/include/section_init.inc.php @@ -193,7 +193,7 @@ SELECT name, url_name, id } $result = pwg_query($query); $tag_infos = array(); - while ($row = mysql_fetch_array($result)) + while ($row = mysql_fetch_assoc($result)) { $tag_infos[ $row['id'] ] = $row; array_push($page['tags'], $row );//we loose given tag order; is it important? @@ -410,29 +410,7 @@ SELECT image_id ); } - $title = count($page['tags']) > 1 ? l10n('Tags') : l10n('Tag'); - $title.= ' '; - - $tag_num = 1; - foreach ($page['tag_ids'] as $tag_id) - { - $title.= - ($tag_num++ > 1 ? ' + ' : '') - .'<a href="' - .make_index_url( - array( - 'tags' => array( - array( - 'id' => $tag_id, - 'url_name' => $tag_infos[$tag_id]['url_name'], - ), - ) - ) - ) - .'">' - .$tag_infos[$tag_id]['name'] - .'</a>'; - } + $title = get_tags_content_title(); $page = array_merge( $page, |