*
Welcome, Guest. Please login or register.
Did you miss your activation email?
September 06, 2010, 02:03:37 PM


Login with username, password and session length

Author Topic: mod for showing albums in 4 rows on viewalbums.php page  (Read 1551 times)
Support
Administrator
Sr. Member
*****
Offline Offline

Posts: 468


View Profile
« on: October 05, 2008, 07:47:58 PM »

mod for showing albums in 4 rows on viewalbums.php page

open viewalbums.php and empty the page and enter the below code

Quote
<?
/*
--------------------------------------------------------------------------
|   Musicbox Version 2.3.7
|   ========================================
|   by Shalwan
|   (c) 2008 Shalwan Enterprises LLC
|   http://www.shalwan.com
|   ========================================
|   Web: http://www.musicboxv2.com 
|   Email: products@shalwan.com
|   Licence Info: http://www.shalwan.com/license
--------------------------------------------------------------------------- 
*/
 @include("sources/session.php");
 @include("sources/functions.php");
 $sql="select * from config where id=3";
 $rs=mysql_query($sql) or die(mysql_error());

 $row=mysql_fetch_array($rs);
 
 ob_start();
 @include("template/header2.php");
 
 define('ITEMS_PER_PAGE', 40);
 
 function getAlbumCount()
 {
    $query = "select count(*) as 'total' from album, artist";
    $results = mysql_query($query);
    $row = mysql_fetch_assoc($results); 
    
    return $row['total'];     
 }
 
  function getSongCount($id)
  {
     $query = "select count(*) as 'total' from song where album_id = '$id'";
     $results = mysql_query($query);
     $row = mysql_fetch_assoc($results); 
     
     return $row['total'];     
 }
 
 
 $genre_id = $_GET['id'];   
 
 $items = ITEMS_PER_PAGE;
 
 if(isset($_GET['page']))
 {
    $offset = $_GET['page'];
    $offset *= $items;
    $query = "select artist.id as artist_id, artist.name as artist_name, artist_photo, album.id as album_id, album.album_name, album.album_photo from artist, album limit $offset,$items";
 }
 else 
 {
   $query = "select artist.id as artist_id, artist.name as artist_name, artist_photo, album.album_name, album.id as album_id, album.album_photo from artist, album";
 }

 $allAlbums = mysql_query($query);
 
 echo "<table class='moduletable' cellpadding = '0' cellspacing = '0'><tr><th>All Albums</th></tr></table>";
 
 if(!allAlbums) 
 {
    echo 'There are no albums in database';
 }
 else
 {
    while($album = mysql_fetch_assoc($allAlbums))
    {
       $albumPhoto = $album['album_photo'];
       $artistName = $album['artist_name'];
       $albumName = $album['album_name'];
       
       print("<table class ='albumbox'><tr><td><table class='albumbox2'><tr><td><a href='index.php?action=album&id=".$album['album_id']."'><img src='$albumPhoto' /></a></td>");
       print("<td valign='top'>");
       print("<b><a href='index.php?action=album&id=".$album['album_id']."'>$albumName</a></b><br />");
       print("<b><a href='index.php?action=artist&id=".$album['artist_id']."'>$artistName</a></b><br />");        
       print("Total Songs: ".getSongCount($album['album_id']).'<br />');
       print("</td></tr></table></td></tr></table>");     
    }
 }

 mysql_free_result($allAlbums);
 $albumCount = getAlbumCount(); //mysql_num_rows($allArtists);
 
 // Paginate
 
 $numPages = floor($albumCount / ITEMS_PER_PAGE);   
 
if($numPages > 0 )
{
    print('<table class="moduletable" align="left"><tr><td><center>Pages[');
    for($i = 0; $i < $numPages; $i++)
    {
      print("<a href='?id=$genre_id&page=$i'> ".($i+1).' </a>');     
    }
   print(']</center></td></tr></table>');
}

 include("template/header_bottom.php");
 ob_end_flush();

?>

now open template/musicboxv2.css and paste the below code

Quote
table.albumbox {

  width            : 33%;

  /*table-layout      : auto; */

  float: left; /*modified*/

}

.three_column_table {



  width: 100%;       
 
}
Logged
Pages: [1]
Jump to:  

Copyright © 2010 MusicboxV2.com - Shalwan Enterprises