Tree connectors do not display when Clean URLs are disabled

timjh - January 12, 2009 - 11:49
Project:Family Tree 2
Version:6.x-1.1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

At least for the time being, I am forced to run my website with Clean URLs disabled, and I am finding that the connecting images in Ascendants and Descendants trees are not displayed.

With Clean URLs disabled, the tree.inc module currently generates links to image src files in the "/?q=" form, which (as far as I understand these things) is incorrect for file references. I have edited my copy of tree.inc to remove the url function packaging, and it now works correctly. For example

...url(drupal_get_path('module', 'family') .'/img/asctree.png',array('absolute' => TRUE))...

is replaced by

...drupal_get_path('module', 'family') .'/img/asctree.png'...

The revised src reference is relative, in the form
src="sites/all/modules/family/img/asctree.png"
which I believe to be preferable to an absolute reference (which would have a leading /), since relative references are interpreted relative to the base path of the Drupal installation, so that (for example) it all still works if you move the entire Drupal installation to a sub-directory.

#1

timjh - January 24, 2009 - 15:54

My solution above breaks when Clean URLs are enabled. I've changed the code to put in an absolute URL. Throughout tree.inc, replace

...url(drupal_get_path('module', 'family') .'/img/asctree.png',array('absolute' => TRUE))...

by

...$base_url.'/'.drupal_get_path('module', 'family') .'/img/asctree.png'...

which works with Clean URLS on or off. I haven't tried it with the site in a sub-directory, but I think it ought to work.

Of course, I also put the essential global $base_url; at the head of each relevant function.

#2

ailgm - May 7, 2009 - 13:37

subscribing

 
 

Drupal is a registered trademark of Dries Buytaert.