From cd73e27fe1651708672f815f057c7ea63f4cd047 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Thu, 6 Aug 2009 03:39:43 +0000 Subject: [PATCH] MINOR fix rewrite of anchors git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@83936 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/SSViewer.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/SSViewer.php b/core/SSViewer.php index cb707ab80..fa9090b20 100644 --- a/core/SSViewer.php +++ b/core/SSViewer.php @@ -355,15 +355,15 @@ class SSViewer extends Object { $output = $val; $output = Requirements::includeInHTML($template, $output); - + array_pop(SSViewer::$topLevel); if(isset($_GET['debug_profile'])) Profiler::unmark("SSViewer::process", " for $template"); - + // If we have our crazy base tag, then fix # links referencing the current page. if(strpos($output, '+]href *= *)"#/i', '\\1"' . $thisURLRelativeToBase . '#', $output); + $output = preg_replace('/(href=".*)#(.*")/i', '\\1' . $thisURLRelativeToBase . '#\\2', $output); } return $output; @@ -509,7 +509,9 @@ class SSViewer extends Object { $content = ereg_replace('', '', $content); // Fix link stuff - $content = ereg_replace('href *= *"#', 'href="#', $content); + /* + $content = ereg_replace('href *= *"#', 'href="#', $content); + */ // Protect xml header $content = ereg_replace('<\?xml([^>]+)\?' . '>', '<##xml\\1##>', $content);