Arrow images not showing when Drupal is not installed at DocumentRoot

druido - June 9, 2009 - 16:10
Project:Bibliography Module
Version:6.x-1.5
Component:Code
Category:bug report
Priority:minor
Assigned:Unassigned
Status:closed
Description

A minor problem: when Drupal is installed in a user's ~/public_html, the small arrows beside the "Sort by" links do not show up, because the generated links pointing at the wrong location. Attached you find a patch, which essentially changes the links to the images to relative ones.

AttachmentSize
biblio.pages_.inc_.diff986 bytes

#1

rjerome - June 9, 2009 - 21:11

I had it like that before, but I think there will still be a problem if you apply any filters.

#2

druido - June 11, 2009 - 16:53
Status:patch (to be ported)» active

You're right... But maybe there is a way to generate a link that works in every case?

#3

rjerome - June 11, 2009 - 20:59

Could you try adding the "$base_path" global as shown below...

<?php
function _biblio_sort_tabs($attrib, $options) {
  global
$base_path       //  <====== add this line                                
 
$content = '';
 
$sort_links = array();
 
$tabs = variable_get('biblio_sort_tabs_style', 0);
 
$order = ($attrib['order'] == "desc" || $attrib['order'] == "DESC")?"asc":"desc";
 
$cur_order = ($attrib['order'] == "desc" || $attrib['order'] == "DESC")?"desc":"asc";
 
$path = drupal_get_path('module','biblio');
// add $basei_path to this line...
 
$order_arrow = ($order == 'asc') ? '<img src ="'.$base_path.$path.'/arrow-asc.png" alt =" (Desc)" />':'<img src ="/'.$path.'/arrow-desc.png" alt = " (Asc)" />';
 
$sort_links variable_get('biblio_sort_tabs', array('author'=>'author', 'title'=>'title', 'type'=>'type', 'year'=>'year', 'keyword'=>'keyword'));
 
ksort($sort_links);
 
$content .= $tabs ? '<ul class="tabs secondary ">':'';
?>

or this diff...

### Eclipse Workspace Patch 1.0
#P biblio-dev
Index: biblio.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/biblio/biblio.pages.inc,v
retrieving revision 1.1.2.90
diff -u -r1.1.2.90 biblio.pages.inc
--- biblio.pages.inc 11 Jun 2009 13:23:40 -0000 1.1.2.90
+++ biblio.pages.inc 11 Jun 2009 20:58:20 -0000
@@ -525,12 +525,13 @@

function _biblio_sort_tabs($attrib, $options) {
   $content = '';
+  global $base_path;
   $sort_links = array();
   $tabs = variable_get('biblio_sort_tabs_style', 0);
   $order = ($attrib['order'] == "desc" || $attrib['order'] == "DESC")?"asc":"desc";
   $cur_order = ($attrib['order'] == "desc" || $attrib['order'] == "DESC")?"desc":"asc";
   $path = drupal_get_path('module','biblio');
-  $order_arrow = ($order == 'asc') ? '<img src ="/'.$path.'/arrow-asc.png" alt =" (Desc)" />':'<img src ="/'.$path.'/arrow-desc.png" alt = " (Asc)" />';
+  $order_arrow = ($order == 'asc') ? '<img src ="'.$base_path.$path.'/arrow-asc.png" alt =" (Desc)" />':'<img src ="/'.$path.'/arrow-desc.png" alt = " (Asc)" />';
   $sort_links =  variable_get('biblio_sort_tabs', array('author'=>'author', 'title'=>'title', 'type'=>'type', 'year'=>'year', 'keyword'=>'keyword'));
   ksort($sort_links);
   $content .= $tabs ? '<ul class="tabs secondary ">':'';

#4

druido - June 13, 2009 - 08:36
Status:active» patch (to be ported)

Of course, it should be:

$order_arrow = ($order == 'asc') ? '<img src ="'.$base_path.$path.'/arrow-asc.png" alt =" (Desc)" />':'<img src ="'.$base_path.$path.'/arrow-desc.png" alt = " (Asc)" />';

Yes, that works for me, thank you.

#5

rjerome - June 14, 2009 - 21:31
Status:patch (to be ported)» fixed

Right you are! This has been committed to the -dev branch and will be subsequent releases.

Ron.

#6

xoxox - June 18, 2009 - 14:11

how to apply the patch?

#7

rjerome - June 18, 2009 - 14:13

You can download and install the -dev version just like 1.5 version and then when 1.6 comes out, you can go back to the release version.

#8

System Message - July 2, 2009 - 14:20
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.