Xml load not working without clean URLs

Cristhian - October 13, 2009 - 19:06
Project:Units API
Version:6.x-1.0-alpha1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

In unitsapi.module, line 110 there is:

<?php
  $file
= url(drupal_get_path('module', 'unitsapi'), array('absolute' => TRUE)) .'/units.xml';
?>

But if you dont have clean urls enabled you get something like mysite.com/?q=sites/all/modules/unitsapi/units.xml in the file to load, so it causes an error.

I solve it by this way:

<?php
  $file
= str_replace('?q=', '', url(drupal_get_path('module', 'unitsapi'), array('absolute' => TRUE)) .'/units.xml');
?>

But maybe isn't the right way to fix it.

 
 

Drupal is a registered trademark of Dries Buytaert.