mimetypes into css classes

Author Message

gareth eke

Tuesday 23 September 2008 6:35:35 am

hi

i've been using the EZ functionality that creates a div class based on a binary type such as:

<div class="content-body attribute-pdf">link to the binary in the media library</div>

to style these classes with an icon for the particular type of binary file being linked to:

.attribute-pdf a {
background-image: url('../images/icons/pdf_icon.gif');
font-weight: normal;

this works fine until i've tried to apply styles to an XLS file for example:

<div class="content-body attribute-vnd.ms-excel">
<p>New XLS file </p>
</div>

i think the full stop punctuation in the mimetype is preventing me from writing a piece of CSS that can target the div to style it (unless my CSS skills aren't very good!), so i've been trying remove this but without success. ideally i'd like the code to output something without the . full stop punctuation such as:

<div class="content-body attribute-ms-excel">
<p>New XLS file </p>
</div>

i've tried the ezmimetype.php in lib but with no success. any ideas anybody?

thanks

Ivo Lukac

Tuesday 23 September 2008 11:58:05 pm

Hello gareth,

Just do something like this:
{def $mime_array=$mime|explode('.')}

An use it like this:
{$mime_array.1}

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

gareth eke

Wednesday 08 October 2008 7:13:44 am

brilliant, thanks Ivo

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.