[TYPO3-dev] setting 'prefixLocalAnchors' is killing FE output
Dmitry Dulepov [typo3]
dmitry at typo3.org
Fri Apr 4 20:04:19 CEST 2008
Hi!
Franz Koch wrote:
> 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.
It will not if you do not make a patch...
--
Dmitry Dulepov
TYPO3 core team
Web: http://typo3bloke.net/
Skype: callto:liels_bugs
"Nothing is impossible. There are only limits to our knowledge"
More information about the TYPO3-dev
mailing list