Icons for file format
Posted: 27 February 2010 12:33 AM   [ Ignore ]  
Newbie
Rank
Total Posts:  20
Joined  2010-01-11

Andrew, on your “using the module” page, you show file icons by the titles.

I’ve included the icon class in my code but the icon doesn’t appear. Are there other settings or paths I need to change for this?

Profile
 
 
Posted: 10 March 2010 10:53 PM   [ Ignore ]   [ # 1 ]  
Newbie
Rank
Total Posts:  20
Joined  2010-01-11

Just checking in, Andrew. Any thoughts on this?

Profile
 
 
Posted: 12 March 2010 04:24 PM   [ Ignore ]   [ # 2 ]  
Administrator
RankRankRankRank
Total Posts:  179
Joined  2006-04-12

Sorry for not replying sooner.

The icons are from FamFamFam

The template is:

{exp:ajw_client_downloads:folder orderby="id"}

{if no_results}
<p>There are no folders for this user</p>{/if}

<h3>{folder_title}</h3>

<
p>{folder_description}</p>

<
table width="100%">
    <
thead>
        <
tr>
            <
th>&nbsp;</th>
            <
th>Title</th>
            <
th>Size</th>
            <
th>Date</th>
            <
th>Extension</th>
        </
tr>
    </
thead>
    <
tbody>
        
{if no_assets}<tr><td colspan="5">There are no assets in this folder</td></tr>{/if}
        {assets orderby
="title"}
        
<tr class="{switch="one|two"}">
            <
td>{id}</td>
            <
td><a href="{url}" class="icon icon-{extension}">{title}</a></td>
            <
td>{size}</td>
            <
td>{date}</td>
            <
td>{extension}</td>
        </
tr>
        
{/assets}
    
</tbody>
</
table>

{/exp:ajw_client_downloads:folder} 

The CSS to get the icons to work is:

a.icon,
a.icon-none {
    border
0;
    
padding4px 0 4px 20px;
    
backgroundtransparent url(/images/icons/page_white.pngno-repeat 0 50%;
}
a
.icon-pdf {
    padding
-left20px;
    
backgroundtransparent url(/images/icons/page_white_acrobat.pngno-repeat 0 50%;
}
a
.icon-zip {
    padding
-left20px;
    
backgroundtransparent url(/images/icons/page_white_zip.pngno-repeat 0 50%;
}
a
.icon-txt {
    padding
-left20px;
    
backgroundtransparent url(/images/icons/page_white_text.pngno-repeat 0 50%;
}
a
.icon-png,
a.icon-gif,
a.icon-jpg {
    padding
-left20px;
    
backgroundtransparent url(/images/icons/page_white_picture.pngno-repeat 0 50%;
}
a
.icon-rtf,
a.icon-doc {
    padding
-left20px;
    
backgroundtransparent url(/images/icons/page_white_word.pngno-repeat 0 50%;

Each file is given a default class “icon” which provides the default formatting. This is then over-ridden with an “icon-extension” style class which changes the icon depending on the files extension.

Hope that makes sense!

Andrew

Profile
 
 
Posted: 12 March 2010 06:33 PM   [ Ignore ]   [ # 3 ]  
Newbie
Rank
Total Posts:  20
Joined  2010-01-11

Ah. I see what you’re doing. I’ll give it a go. Not crucial for launch but it does look great.

On a related note, is there a way to add file types? I have a MP3 in my files and it comes up “none” in the file type?

Profile