I've created a custom module that pulls data from a separate database and then renders a bar chart. However, the chart never rendered. I viewed the source of the web page and saw this:
<script type="text/javascript">
<!--//--><![CDATA[//><!--
swfobject.embedSWF("//sites/all/libraries/ofcv2/open-flash-chart.swf", "ofc_057245b366ab7841589c81504c61", "400", "250", "9.0.0", false, {"get-data":"ofc_057245b366ab7841589c81504c61"}, [ ])
//--><!]]>
</script>
Notice the leading "/" in the path to the SWF file.
So, on a wild guess, I modified line 91 of open_flash_chart_api.module from:
$swf = url(base_path() . variable_get('open_flash_chart_api_library_path', 'sites/all/libraries/ofcv2') . '/open-flash-chart.swf');
...to:
$swf = url(variable_get('open_flash_chart_api_library_path', 'sites/all/libraries/ofcv2') . '/open-flash-chart.swf');
This removed the extra leading "/", and the chart loaded correctly.
This behavior occurred in Firefox and IE.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | open_flash_chart_api-846484-5.patch | 1.21 KB | Anclywen |
| #3 | screenshot.png | 38.66 KB | MaffooClock |
Comments
Comment #1
MaffooClock commentedI just noticed that this workaround does allow Firefox to display the SWF, but in IE8 the behavior is the same (no SWF), and toggling Compatibility View has no effect.
Also, for clarification, in IE the only things that's displayed is the "Get Adobe Flash Player" button.
Woops. Apparently Flash was installed for Firefox, but not for IE. The above workaround resolves my problem. Can anyone else confirm that the extra "/" is a problem?
Comment #2
redndahead commentedLook under admin/settings/open_flash_chart_api and if you specified a path remove the beginning '/'
Comment #3
MaffooClock commentedThere is no leading slash.
Comment #4
pedrorocha commentedI'm having the same problem and i the question is that both url() and base_path() append the base path in the beggining of the string.
The solution is to remove one of them. (i'm in hurry right now, but will try to come back later and apply the patch)
As said by MaffooClock, the change must be on "open_flash_chart_api.module", line 91
or
will work ;)
Comment #5
Anclywen commented//I changed priority, I couldn't render any single graph :(
IMHO first option is better one, because base_path() is already used in url()
Comment #6
pedrorocha commentedThanks Anclywen. I commited the patch. Just need to wait for the next development snapshot.