[TYPO3-mvc] Translate f:uri.resource from "EXT:tx_ext..." to correct path?
Gianluca Strafella
gianluca.strafella at webformat.com
Thu Nov 14 09:19:30 CET 2013
Hi Jan,
in your extention you should have a controller also to the backend module.
If this controller is used by frontend and backend you can check if you
are in FE or in BE with global typo3 var "TYPO3_MODE".
In your controller you can check variable $this->settings['jsfile'], so
you could add your extention path at path in ""tx_ext_js""
In example you could have (in controller):
if(TYPO3_MODE === 'BE'){
$jsFile = $this->settings['jsfile'];
$finalPath = some_function($jsFile);
$this->view->assign('jsBePath', $finalPath);
}
in "some_function" you could use:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath("your_extention_key")
So, you could have two different templates to frontend plugin and
backend module. In your frontend plugin you could have "standard" notation:
<f:be.container addJsFile="{f:uri.resource(path: '{settings.tx_ext_js}')}">
</f:be.container>
in backend template you could use variable "jsBePath" injected by
controller:
<f:be.container addJsFile="jsBePath"></f:be.container>
I haven't try it, but it could work ... can be a similar solution ?
Gianluca Strafella
Software Developer
gianluca.strafella at webformat.com
Tel. +39-0427-926.389
WEBFORMAT srl – www.webformat.com
Via Mecenate, 76 - 20138 MILANO
Corte Europa, 12 - 33097 SPILIMBERGO (PN)
Il 13/11/2013 11:50, Jan Kornblum ha scritto:
> Hi Gianluca,
>
> thanks for your reply.
>
>> {f:uri.resource path: '{settings.tx_ext_js}'}
>>
>> the view helper (ResourceViewHelper) , assumes that the "resource" is
>> located in path "Resources/Public" of your extention:
>> typo3conf/ext/your_ext_key/Resources/Public/
>>
>> So, in settings.tx_ext_js, you should only have this path:
>> "Js/script.js".
>> In this way, ResourceViewHelper will build this path:
>>
>> typo3conf/ext/your_ext_key/Resources/Public/Js/script.js
>
> Yes, i've figured this out in between, too. The reason for my request
> was just, that i've got a definition for the frontend plugin with a
> usual path like "EXT:my_ext...", and i would like to "copy" this setting
> into my backend module like module.tx_myext.settings.jsfile <
> plugin.tx_myext.settings.jsfile.
>
> As i know know that f:uri.resource cannot translate an "EXT:" prefix, i
> need to have two different annotations for plugin and module ;)
>
> Kind regards, Jan
>
>
More information about the TYPO3-project-typo3v4mvc
mailing list