diff options
author | friendica <info@friendica.com> | 2014-06-17 20:45:53 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-06-17 20:45:53 -0700 |
commit | 8b66329a8f3705e7ccf868093ee2debaa8e4bdca (patch) | |
tree | 1d40bd37e30f16fa74d4afdfece5fe1d2cc7f969 | |
parent | 35d42f86265f9ce9dfaaae0298c35d056d0e9ed8 (diff) | |
download | volse-hubzilla-8b66329a8f3705e7ccf868093ee2debaa8e4bdca.tar.gz volse-hubzilla-8b66329a8f3705e7ccf868093ee2debaa8e4bdca.tar.bz2 volse-hubzilla-8b66329a8f3705e7ccf868093ee2debaa8e4bdca.zip |
add photo count to photo album list
-rw-r--r-- | include/photos.php | 5 | ||||
-rwxr-xr-x | view/tpl/photo_albums.tpl | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/include/photos.php b/include/photos.php index 65532e6c2..de4a9173a 100644 --- a/include/photos.php +++ b/include/photos.php @@ -264,7 +264,7 @@ function photos_albums_list($channel,$observer) { $sql_extra = permissions_sql($channel_id); - $albums = q("SELECT distinct album from photo where uid = %d and ( photo_flags = %d or photo_flags = %d ) $sql_extra order by created desc", + $albums = q("SELECT count( distinct resource_id ) as total, album from photo where uid = %d and ( photo_flags = %d or photo_flags = %d ) $sql_extra group by album order by created desc", intval($channel_id), intval(PHOTO_NORMAL), intval(PHOTO_PROFILE) @@ -279,7 +279,8 @@ function photos_albums_list($channel,$observer) { $ret['success'] = true; foreach($albums as $k => $album) { $entry = array( - 'text' => $album['album'], + 'text' => $album['album'], + 'total' => $album['total'], 'url' => z_root() . '/photos/' . $channel['channel_address'] . '/album/' . bin2hex($album['album']), 'urlencode' => urlencode($album['album']), 'bin2hex' => bin2hex($album['album'])); diff --git a/view/tpl/photo_albums.tpl b/view/tpl/photo_albums.tpl index e83eefb39..7ff4a8cc0 100755 --- a/view/tpl/photo_albums.tpl +++ b/view/tpl/photo_albums.tpl @@ -3,7 +3,9 @@ {{if $albums}} <ul> {{foreach $albums as $al}} -<li><a href="{{$baseurl}}/photos/{{$nick}}/album/{{$al.bin2hex}}">{{$al.text}}</a></li> +{{if $al.text}} +<li><a href="{{$baseurl}}/photos/{{$nick}}/album/{{$al.bin2hex}}">{{$al.text}}</a> ({{$al.total}})</li> +{{/if}} {{/foreach}} </ul> {{/if}} |