Seeking Guidance on Implementing HighCharts in Joomla

依然范特西╮ 提交于 2019-12-25 05:23:07

问题


We want to implement HighCharts in our custom Joomla module. Since it's a Javascript library, do we attach it to the view as a reference to the script files? I've also read about a PHP wrapper for HighCharts. Is it advisable to use it instead of the direct Javascript library?


回答1:


To embed Javascript files into a Joomla module, you need to use the following code:

$document =& JFactory::getDocument();
$document->addScript(JURI::root() . "modules/mod_your_module/file.js");
$document->addScript(JURI::root() . "modules/mod_your_module/file2.js");
...

If you need to write custom Javascript, then you will need to write it like so:

$js = 'alert("alert message");';
$document->addScriptDeclaration($js);

Hope this helps.



来源:https://stackoverflow.com/questions/12770484/seeking-guidance-on-implementing-highcharts-in-joomla

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!