[TYPO3-dev] setting 'prefixLocalAnchors' is killing FE output
Franz Koch
typo.removeformessage at fx-graefix.de
Fri Apr 4 14:36:06 CEST 2008
Grr, that damn bug again cost me 2 unpaid hours until I remebered it :(
I use this function now which is working like a charm:
------------
function prefixLocalAnchorsWithScript() {
$scriptPath =
substr(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'),strlen(t3lib_div::getIndpEnv('TYPO3_SITE_URL')));
$original_content = $this->content;
$this->content = preg_replace('/(<(a|area).+href=")(#[^"]*")/i','${1}'
. htmlspecialchars($scriptPath) . '${3}',$original_content);
if(preg_last_error()>0) {
//The was an error in call to preg_replace, so keep original content
(Behavior prior t PHP 5.2).
t3lib_div::sysLog('preg_replace returned error-code: ' .
preg_last_error().' in function prefixLocalAnchorsWithScript.
Replacement not done!' , 'cms', 4);
$this->content = str_replace(' href="#','
href="'.htmlspecialchars($scriptPath).'#',$original_content);
}
}
------------
Hope this will make it in 4.2 and 4.1.7.
--
kind regards,
Franz
More information about the TYPO3-dev
mailing list