Hello,
Regarding print view - link anchors borken

this link in print view

turns into:

This link does not work because you are already in the subdirectory.

The 404 page would be:
/subdirectory/print/subdirectory/pagename#anchor

Any ideas would be helpful.

Thanks!

CommentFileSizeAuthor
#2 patch-print.pages_.inc-1.10-anchors.patch565 bytesaasarava

Comments

reload’s picture

with code tags:

this link in print view :
<a href="#anchor">
turns into:
<a href="print/subdirectory/pagename#anchor">

aasarava’s picture

StatusFileSize
new565 bytes

We're having the same problem. I'm attaching the patch for print.pages.inc (version 6.x-1.10) that should hopefully fix it. It's a simple one:

Change line 396 from:

$matches[1] = str_replace($url, $_GET['q'] . $url, $matches[1]);

to:

$matches[1] = str_replace($url, '/' . $_GET['q'] . $url, $matches[1]);

Be sure to check all your other links to make sure this doesn't mess anything else up. Can the maintainers or someone more familiar with the code weigh in on whether this is an appropriate fix?

jcnventura’s picture

Status: Active » Fixed

Indeed, the path needs to be made absolute so that anchors in pages in non-root paths still work.. However the patch in #2 fails in Drupal sites which are installed in a sub-path of the server's document root, instead of '/' it needs to be base_path().

I have committed a patch that fixes this to CVS.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.