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 |
Jump to:
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.
| Attachment | Size |
|---|---|
| biblio.pages_.inc_.diff | 986 bytes |

#1
I had it like that before, but I think there will still be a problem if you apply any filters.
#2
You're right... But maybe there is a way to generate a link that works in every case?
#3
Could you try adding the "$base_path" global as shown below...
<?phpfunction _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
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
Right you are! This has been committed to the -dev branch and will be subsequent releases.
Ron.
#6
how to apply the patch?
#7
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
Automatically closed -- issue fixed for 2 weeks with no activity.