We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum
Forum
Conditionals on file mime type
Is there a way to use conditional statements with the mime type of a file?
I thought I had it working with the following:
<perch:if id="file" type="file" output="mime" match="contains" value="pdf"><i class="icon-file-pdf"></i></perch:if>
But when I try other mime types this does not work. The mime type for the file is correct in the database and is correctly output with:
<perch:content id="file" type="file" output="mime" />
eg a MS Word .docx file outputs the correct mime type "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
It looks like the if statement in my code is ignoring the output="mime" and matching on the filename.
Kevin
Want to reply to this thread?
Login with Perch
I don't believe so, no.
Drew
Thanks, solved it with a quick template filter to return an icon based on mime type.
Kevin