Project:Printer, e-mail and PDF versions
Version:6.x-1.10
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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!

Comments

#1

with code tags:

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

#2

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:

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

to:

<?php
$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?

AttachmentSize
patch-print.pages_.inc-1.10-anchors.patch 565 bytes

#3

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.

#4

Status:fixed» closed (fixed)

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

nobody click here