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.

eZ debug

Timing: Jan 30 2025 21:38:58
Script start
Timing: Jan 30 2025 21:38:58
Module start 'layout'
Timing: Jan 30 2025 21:38:58
Module start 'content'
Timing: Jan 30 2025 21:38:58
Module end 'content'
Timing: Jan 30 2025 21:38:58
Script end

Main resources:

Total runtime0.0222 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 588.1328151.2109
Module start 'layout' 0.00450.0040 739.3438220.6875
Module start 'content' 0.00860.0122 960.0313997.7891
Module end 'content' 0.02080.0014 1,957.820333.9922
Script end 0.0222  1,991.8125 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002511.4512140.0002
Check MTime0.00104.5620140.0001
Mysql Total
Database connection0.00073.148610.0007
Mysqli_queries0.00219.499430.0007
Looping result0.00000.098710.0000
Template Total0.00104.410.0010
Template load0.00083.423110.0008
Template processing0.00020.994110.0002
Override
Cache load0.00052.371110.0005
General
dbfile0.00135.702080.0002
String conversion0.00000.036540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs