Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Raymond Linton on Jul 01, 2008 07:56
open dhtmlx forum
Problem loading dhtmlx through joomla

I am trying to embed your calendar code (and eventually the grid code) into my joomla site, using Joomla 1.5.3. When I load the php page directly, the calendar and related functions operate properly. When calling the php function through joomla, I get dhtmlxCalendarObject is not defined.

The typical workaround in this case, is to use a php include statement to load the javascript into the parsed HTML, so instead of this:

[script type="text/javascript" language="javascript" src="dhtmlxSuite/dhtmlxCalendar/codebase/dhtmlxcalendar.js"][/script]

you would see this:
[script type="text/javascript" language="javascript"]
[?php require_once(JPATH_COMPONENT.DS.'dhtmlxSuite'.DS.'dhtmlxCalendar'.DS.'codebase'.DS.'dhtmlxcalendar.js'); ?]
[/script]
I used square brackets instead of angle brackets because I don't know how your message system will handle the display with angle brackets.
When I use this include feature, the page displaying the calendar goes to the white screen of death, and the HTML source shows the following error:

Parse error: syntax error, unexpected T_STRING in ...\components\com_leonardo\dhtmlxSuite\dhtmlxCalendar\codebase\dhtmlxcalendar.js on line 1802

I looked at the file, but I haven't been able to sort my way through the code yet, and any help to resolve the issue is greatly appreciated.
Answer posted by Support on Jul 01, 2008 08:26
You can use attached js code instead of original one  ( it must not cause such error ), or use next code to include js file

<script type="text/javascript" language="javascript">
<?php
    echo file_get_contents(JPATH_COMPONENT.DS.'dhtmlxSuite'.DS.'dhtmlxCalendar'.DS.'codebase'.DS.'dhtmlxcalendar.js');
?>
</script>

Attachments (1)
Answer posted by Raymond Linton on Jul 01, 2008 08:30
This worked for me quite well. thanks for all the help!