0

I am a fiddling with the CakePHP framework and having an issue getting my page to load an empty calender (DHTMLX scheduler).

Following along with the documentation for DHTMLX scheduler and connector I have everything setup but a blank index page. Looking at the page source, all of the scripts are loading but the init function of the scheduler never fires, thus I get a blank page.

Here is the view in question.

`<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <?php echo $this->Html->script('jquery'); ?>  
  <?php echo $this->Html->script('/dhtmlx/dhtmlxscheduler'); ?>  
  <?php echo $this->Html->css('/dhtmlx/dhtmlxscheduler'); ?>   
</head>  

<body>
  <div id="scheduler_here" class="dhx_cal_container" style='width:100%; height:100%;'>
        <div class="dhx_cal_navline">
            <div class="dhx_cal_prev_button">&nbsp;</div>
            <div class="dhx_cal_next_button">&nbsp;</div>
            <div class="dhx_cal_today_button"></div>
            <div class="dhx_cal_date"></div>
            <div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div>
            <div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div>
        </div>
        <div class="dhx_cal_header">
        </div>
        <div class="dhx_cal_data">
        </div>       
</div>
    <script type="text/javascript" charset="utf-8">
    scheduler.config.multi_day = true;
    scheduler.config.xml_date="%Y-%m-%d %H:%i";
    scheduler.config.first_hour = 5;
    scheduler.init('scheduler_here',new Date(2010,7,5),"week");
</script>
</body>
</html>`
  • You seem to be outputting *everything* in your view. If you're using a layout (which you should in normal situations), you'll end up with a double `` in your page, causing your html to be invalid. Please check the generated output by choosing `view source` in your browser, and read this chapter to understand how CakePHP composes its output using views, elements and layouts: [Views](http://book.cakephp.org/2.0/en/views.html#view-templates) – thaJeztah Apr 27 '13 at 20:40
  • Yeah looking at my page source I have two sections one of which looks to be cake's default settings for the and css (CakePHP: the rapid development php framework). Let me reread that section to try and understand whats going on. Thanks for looking at my question, this has been a strange transition from java. – Clay Lundy Apr 27 '13 at 22:15
  • Alright thaJeztah thanks for the help that corrected the issues. Managed to get the calendar to display, now to see if I can get data on it. – Clay Lundy Apr 27 '13 at 22:48

1 Answers1

0

You seem to be outputting everything in your view.

If you're using a layout (which you should in normal situations), you'll end up with a double <html><head> in your page, causing your html to be invalid.

In most situations, your view should only contain the content for a specific action in a controller. General content, including the <head> of your HTML should be in the layout

Please check the generated output by choosing view source in your browser, and read this chapter to understand how CakePHP composes its output using views, elements and layouts: Views

thaJeztah
  • 27,738
  • 9
  • 73
  • 92