[TYPO3-core] RFC: #11216: getModuleTemplate is prepended with backPath always
Martin Kutschker
masi-no at spam-typo3.org
Fri May 29 11:44:33 CEST 2009
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);
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);
But for me the proper way for an extension is to use an EXT: prefix
(which should be mentioned in the inline docs). See above for the reason.
Masi
More information about the TYPO3-team-core
mailing list