[Cpan-forum-commit] rev 258 - in trunk: . lib/CPAN/Forum/DB templates
svn at pti.co.il
svn at pti.co.il
Thu Jul 19 17:05:24 EEST 2007
Author: gabor
Date: 2007-07-19 17:05:24 +0300 (Thu, 19 Jul 2007)
New Revision: 258
Modified:
trunk/
trunk/lib/CPAN/Forum/DB/Tags.pm
trunk/templates/tags.tmpl
Log:
on the /tags page show number of times a tag is used
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- 7bc34947-122d-0410-bc5a-f898d2bb5f81:/local/cpan-forum:4224
8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:12752
+ 7bc34947-122d-0410-bc5a-f898d2bb5f81:/local/cpan-forum:4225
8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:12752
Modified: trunk/lib/CPAN/Forum/DB/Tags.pm
===================================================================
--- trunk/lib/CPAN/Forum/DB/Tags.pm 2007-07-19 14:05:10 UTC (rev 257)
+++ trunk/lib/CPAN/Forum/DB/Tags.pm 2007-07-19 14:05:24 UTC (rev 258)
@@ -96,12 +96,16 @@
return $self->_fetch_single_value("SELECT id FROM tags WHERE name=?", $text);
}
+# list tags currently in use, along with frequency
sub get_all_tags {
my ($self) = @_;
- my $sql = "SELECT name
- FROM tags
- WHERE id IN (SELECT DISTINCT tag_id FROM tag_cloud) ORDER BY name ASC";
+ my $sql = "SELECT tags.name name, COUNT(name) total
+ FROM tags, tag_cloud
+ WHERE tag_cloud.tag_id=tags.id
+ GROUP BY name
+ ORDER BY name ASC
+ ";
return $self->_fetch_arrayref_of_hashes($sql);
}
Modified: trunk/templates/tags.tmpl
===================================================================
--- trunk/templates/tags.tmpl 2007-07-19 14:05:10 UTC (rev 257)
+++ trunk/templates/tags.tmpl 2007-07-19 14:05:24 UTC (rev 258)
@@ -3,8 +3,7 @@
<TMPL_INCLUDE NAME="navigation.tmpl">
<TMPL_LOOP tags>
-<a href="/tags/name/<TMPL_VAR name>"><TMPL_VAR name></a>
-<TMPL_UNLESS __last__>, </TMPL_UNLESS>
+<a href="/tags/name/<TMPL_VAR name>"><TMPL_VAR name></a>(<TMPL_VAR total>)<TMPL_UNLESS __last__>, </TMPL_UNLESS>
</TMPL_LOOP>
<TMPL_INCLUDE NAME="footer.tmpl">
More information about the Cpan-forum-commit
mailing list