[TYPO3-core] RFC: #11216: getModuleTemplate is prepended with backPath always

Steffen Kamper info at sk-typo3.de
Fri May 29 11:59:51 CEST 2009


Hi Masi,

Martin Kutschker schrieb:
> Steffen Kamper schrieb:
>> Hi,
>>
>> This is SVN patch request.
>>
>> Type: Bugfix
>>
>> Branches: trunk
>>
>> BT reference: http://bugs.typo3.org/view.php?id=11216
>>
>> Problem:
>> when writing BE module extension you may have your template in your
>> extension directory. For now the $filename is always prepended with
>> backpath.
>>
>> Solution:
>> use t3lib_div::getFileAbsFileName which allows using this syntax:
>> $this->doc->setModuleTemplate('EXT:myext/mod1/mod_template.html');
> 
> Please use t3lib_div::getFileAbsFileName($filename, true, true);
>

ok, then kickstarter has to be changed. If someone use the syntax
$this->doc->setModuleTemplate(t3lib_extMgm::extPath('myext') . 
'mod1/mod_template.html');
it will break then, even if this syntax prevent styling by skin ext.

So i'm unsure and would tend to allow abs path for the rare case, but 
would comment it in the function
# use 'EXT:myext/mytemplate.html for own extensions

> Only allowing only relative paths to typo3/ and EXT: will get us
> consistent results with $GLOBALS['TBE_STYLES']['htmlTemplates'][$filename].
> 
> Sidenote: the patch has trailing whitespaces.
> 
> But I think that removing backPath completely may break extensions. So I
> suggest this code:
> 
> if (substr($filename,0,4) != 'EXT:') {
>   $filename = t3lib_div::resolveBackPath($this->backPath . $filename);
> } else {
>   $filename = t3lib_div::getFileAbsFileName($filename, true, true);
> }
> return t3lib_div::getURL($filename);
>

good catch, i tried this also using the tricky (and dirty) one
$this->doc->setModuleTemplate('../typo3conf/ext/myext/mod1/mod_template.html');
and it works.

vg Steffen



More information about the TYPO3-team-core mailing list