We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin: PD Fileformat

Development and Programming

Andy Harris's avatar
Andy Harris
958 posts
16 years ago
Andy Harris's avatar Andy Harris

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.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

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

       
Andy Harris's avatar
Andy Harris
958 posts
16 years ago
Andy Harris's avatar Andy Harris

It’s as simple as can be - works as per:

$format = substr($file_path, strrpos($file_path, '.') + 1);
       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen
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

       
Manoj Thomas's avatar
Manoj Thomas
185 posts
16 years ago
Manoj Thomas's avatar Manoj Thomas

Works just as expected - thanks!

Manoj

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.