I searched for one, but couldn’t find it - so here’s my first plugin effort.
Dead simple - if you fire in a file location it will return the extension of that file. Useful if you want to apply a class/show an icon for that file type - as used in the project I made it for:
{exp:pd_fileformat}{presentation_file}{/exp:pd_fileformat}
You can get it here.
Hi Andy,
Thanks for sharing this I’m sure it will come in handy for a lot of people.
I unfortunately can’t check it out at the moment so I’m just wondering - does this just retrieve the end segment of the file and let you know what the extension is or does it actually check the file out to find out what it is?
Best wishes,
Mark
It’s as simple as can be - works as per:$format = substr($file_path, strrpos($file_path, '.') + 1);
Ah right, no problems. Thought it might be as checking file types is not the easiest thing in the world.
Nice little plugin though and I’m sure it will come in very handy at some point so thanks for sharing.
Best wishes,
Mark
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.