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

$TYPE not rendering {filedir_X}

Development and Programming

Will Smith's avatar
Will Smith
76 posts
16 years ago
Will Smith's avatar Will Smith

Hi all,

I’m developing a module and am trying to have something like {filedir_XX}newsletter_sponsor.jpg rendered as http://www.mysite.com/newsletter_sponsor.jpg. I understand the Typography class is supposed to do this, but I’m not having any luck. Here is my code:

if (!class_exists('Typography')) require PATH_CORE.'core.typography'.EXT;
$TYPE = new Typography; // also tried: new Typography(TRUE, TRUE);
$temp = $TYPE->parse_type($sponsor['image']);
var_dump($temp);

But the output is just {filedir_XX}newsletter_sponsor.jpg, not the fully rendered image URL. Am I not using $TYPE correctly? I’m not getting any error messages, so I believe I am using it correctly.

Any help very much appreciated.

       
Greg Aker's avatar
Greg Aker
6,022 posts
16 years ago
Greg Aker's avatar Greg Aker

Greetings:

Take a look at Functions::fetch_file_paths() at /system/core/core.functions.php.

MOving to the modules dev forums, as the thread is a better fit there.

Regards,

-greg

       
Will Smith's avatar
Will Smith
76 posts
16 years ago
Will Smith's avatar Will Smith

Hi Greg,

Thank you for the reply.

I will take a look at fetch_file_paths().

But I would still like to understand why my use of the Typography class is incorrect? According to the docs here, rendering {filedir_XX} is exactly one of the things the class is meant to do. From the docs:

…if you wanted to have {filedir_#} variables parsed…

Can you tell me where I’m going wrong with how I’m using $TYPE?

Thanks!

       
Derek Jones's avatar
Derek Jones
7,561 posts
16 years ago
Derek Jones's avatar Derek Jones

What version and build are you running, Will? Build numbers are available at the bottom of any control panel page.

       
Will Smith's avatar
Will Smith
76 posts
16 years ago
Will Smith's avatar Will Smith

Hi Derek, thanks for replying. I’m running ExpressionEngine 1.6.6, Build 20081114.

       
Derek Jones's avatar
Derek Jones
7,561 posts
16 years ago
Derek Jones's avatar Derek Jones

I have a feeling you may be affected by a bug fixed in 1.6.7 build 20090211.

Fixed a bug where {filedir_#} variables were not being parsed in user submitted content when Allow All HTML was used.
       
Derek Jones's avatar
Derek Jones
7,561 posts
16 years ago
Derek Jones's avatar Derek Jones

Anything to report, Will?

       
Will Smith's avatar
Will Smith
76 posts
16 years ago
Will Smith's avatar Will Smith

Hey Derek,

Thank you for the follow-up. It took me a few days to get around to upgrading to 1.6.7. But I finally did that tonight, and YES, it looks like it solved the problem! The {filedir_XX} text is now rendering correctly, using the syntax I described above.

Great support, thank you 😊

       
Derek Jones's avatar
Derek Jones
7,561 posts
16 years ago
Derek Jones's avatar Derek Jones

Glad to help, Will!

       

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.