Show albums on summary

2006-03-10 @ 17:50 in Blaogy Dev

Ok I made the code to show album in summary if anybody needs it

The aim of this is that people in my blogs post more albums than texts so I needed to show on the summary page that the blog is really active by the posted albums.

Here are my modifications.

in /class/summary/dao/summarystats.class.php
add this method
/** * Returns an array of last albums * addition by [email protected] to show recent * albums in summary * * @param maxAlbums The maximum number of album to return * @return An array of album */ function getRecentAlbums( $maxAlbums = 0) { $query = "SELECT id, owner_id, description, name, flags, parent_id, date, properties, show_album FROM ".$this->getPrefix()."gallery_albums WHERE show_album = 1 ORDER BY id DESC LIMIT 0, $maxAlbums"; $result = $this->Execute( $query ); if( !$result ){ return Array(); } $albums = Array(); while( $row = $result->FetchRow()) { $album = $this->albums->getAlbum( $row["id"]); array_push( $albums, $album ); } $result->Close(); return $albums; } Then in
/class/summary/action/summarydefaultaction.class.php inside perform() method, add these
//added by [email protected] $recentAlbums = $stats->getRecentAlbums( $this->_numPosts ); $this->_view->setValue( "recentAlbums", $recentAlbums ); Now you can show it in
/templates/summary/index.template {* added by [email protected] *} {if $recentAlbums}

{$locale->tr("resources")}

    {foreach name=recentalbum from=$recentAlbums item=album} {assign var=albumOwnerId value=$album->getOwnerId()} {assign var="blog" value=$blogs[$albumOwnerId]} {assign var="url" value=$blog->getBlogRequestGenerator()} {if $smarty.foreach.recentalbum.first} {/if} {/foreach}
{/if}
If anybody can perform it then welcome... and let me know.

Verindrohy (trackback)

Momba ahy
hery

Ho hitanao ato ny isandroko. Angoniko ato mba hovakiako indray any aoriana any :-)

calendar
« Aogositra 2024 »
At Ta Ar Ak Zo As Ah
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Rohy
  • Blogroll
Tahiry