[FLOW3-general] Accessing resources from classes
Robert Lemke
robert at typo3.org
Wed Dec 2 08:32:47 CET 2009
Hi Zach,
Am 02.12.2009 um 04:31 schrieb Zachary Davis, Cast Iron Coding LLC:
> Thanks for that answer, Manuel. It does indeed help. I think that there could easily be a couple hundred messages. In my experience, even a modest form can end up with dozens of labels for fields, hints, and errors. So, I guess what I'm wondering is that if I go the route of creating a object to fetch labels, is there a public API in FLOW3 for accessing files in the resources directory?
well, there will be even an API for fetching labels, but unfortunately we're not there yet.
However, if you would like to access a file in the Resources folder of package "Foo", you can use FLOW3's stream handler for this:
$content = file_get_contents('package://Foo/Private/My/SpecialFile.txt');
In a Fluid template you can only refer to files located in the Resources/Public/ directory and you do that via the URI view helper.
Points to Foo/Resources/Public/Images/MyLogo.png if the current package is Foo:
<img src="{f:uri.resource(path: 'Images/MyLogo.png')}">
I hope that helps,
robert
--
Robert Lemke
Fluent Code Artisan
http://typo3.org
http://flow3.typo3.org
More information about the FLOW3-general
mailing list