1.44 build 177
Please rate DAlbum at HotScripts.com
Please rate DAlbum at @ PHP-Resource.de
Rate DAlbum @ The PHP Resource Index
Script Rating:
Change tree icons   

By default a yellow folder image is displayed for folders and a blue film icon is used for album icons. This sample demonstrates how album administrator can change tree icon for any album or folder.

For example this demo uses a special icon for Media folder.

This sample adds two custom fields to every album:

  • Iconfile - name of the graphics file to be displayed as icon for a closed folder or an album
  • IconfileOpen - name of the graphics file for an open folder

These custom fields can be set in album properties or .albumdef.ini file. The sample assumes that icon files are stored in subdirectory custimg of the main DAlbum directory.

Instructions

1. Edit you custom.php and add the following code. Modify icons location directory and other parameters as needed:

 class CExAlbumCustomIcon extends CAlbum
{
    function 
GetTreeNodeCode($myID,$nParentID,$sText,$sRef)
    {
        
$dir="custimg/";
        
$ic=$this->GetCustomField("Iconfile");
        
$icOpen=$this->GetCustomField("IconfileOpen");
        if (!empty(
$ic))
        {
            if (empty(
$icOpen))
                
$icOpen=$ic;

            
// You can change not only icon but also text, tooltip and target frame here
            // Format:
            //         d.add($myID,$nParentID,"Node text","Node URL","Tooltip","Target frame",
            //              "Closed icon", "Open icon (for folders only)");
            //
            
return "d.add($myID,$nParentID,'$sText','$sRef','','','$dir/$ic','$dir/$icOpen');\n";
        }
        return 
parent::GetTreeNodeCode($myID,$nParentID,$sText,$sRef);
    }

    
// Get list of custom field names
    
function &GetCustomFieldNames()
    {
        
$f=parent::GetCustomFieldNames();
        
$f[]="Iconfile";
        
$f[]="IconfileOpen";
        return 
$f;
    }
}

function &
customCreateAlbum()
{
    return new 
CExAlbumCustomIcon();
}

2. Reindex (you may also need to delete .private/.album_index.dat file). Now when you edit properties of any album now, set folder image icon. For example specify media.gif to display custimg/media.gif.