uri.resource ViewHelper <f:uri.resource>
¶
A ViewHelper for creating URIs to resources.
This ViewHelper should be used for extension resource files.
For images within FAL storages, or where graphical operations are performed, use <f:uri.image> instead.
Examples¶
Best practice with EXT: syntax¶
<link href="{f:uri.resource(path:'EXT:indexed_search/Resources/Public/Css/Stylesheet.css')}" rel="stylesheet" />
Copied!
Output:
<link href="typo3/sysext/indexed_search/Resources/Public/Css/Stylesheet.css" rel="stylesheet" />
Copied!
Preferred syntax that works in both extbase and non-extbase context.
Defaults¶
<link href="{f:uri.resource(path:'Css/Stylesheet.css')}" rel="stylesheet" />
Copied!
Output:
<link href="typo3conf/ext/example_extension/Resources/Public/Css/Stylesheet.css" rel="stylesheet" />
Copied!
Works only in extbase context since it uses the extbase request to find current extension, magically adds 'Resources/Public' to path.
With extension name¶
<link href="{f:uri.resource(path:'Css/Stylesheet.css', extensionName: 'AnotherExtension')}" rel="stylesheet" />
Copied!
Output:
<link href="typo3conf/ext/another_extension/Resources/Public/Css/Stylesheet.css" rel="stylesheet" />
Copied!
Magically adds 'Resources/Public' to path.
Arguments¶
path¶
- DataType
- string
- Required
- true
- Description
- The path and filename of the resource (relative to Public resource directory of the extension).
extensionName¶
- DataType
- string
- Required
- false
- Description
- Target extension name. If not set, the current extension name will be used
absolute¶
- DataType
- mixed
- Required
- false
- Description
- If set, an absolute URI is rendered