Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-03-14 12:46:13

Matl
Member
From: Brannenburg, Germany
Registered: 2007-06-18
Posts: 13
Website

Good Looking Download List

I’m searching for a good looking download list. But I cannot find something like this. It should show a special icon to different file endings like .gif; .pdf; .doc … Is there anybody, who has a tipp for me?

Offline

#2 2008-03-14 13:31:50

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: Good Looking Download List

Put this in your “files” form

<p class="
<txp:php> 
$fn = file_download_name( array () );  # read download filename
$ext = explode('.', $fn);   # split at dot
$ext = $ext[ count($ext) - 1 ];  # assume last part is extension, a file type
echo $ext.'_icon'.'">';   # build class name"
</txp:php>
<txp:file_download_link>
<txp:file_download_description /> 
</txp:file_download_link> 
</p>

then in your css write something like:

p.pdf_icon a
{
	background:url(images/pdf_icon.gif) no-repeat;
	padding-left:15px;
}
p.doc_icon a
{
	background:url(images/doc_icon.gif) no-repeat;
	padding-left:15px;
}
...and so on for every extension

Note I’ve found this code a long time ago so I can’t give credit to the original autor

Offline

Board footer

Powered by FluxBB