CI calendar class init complete


/ Published in: PHP
Save to your folder(s)

Complete initialization for the new calendar class


Copy this code and paste it in your HTML
  1. public function schedule()
  2. {
  3. $prefs = array(
  4. 'day_type' => 'long',
  5. 'template' => '
  6.  
  7. {table_open}<table id="cal" border="0" cellpadding="0" cellspacing="0">{/table_open}
  8.  
  9. {heading_row_start}<tr>{/heading_row_start}
  10.  
  11. {heading_previous_cell}<th><a href="{previous_url}">&lt;&lt;</a></th>{/heading_previous_cell}
  12. {heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell}
  13. {heading_next_cell}<th><a href="{next_url}">&gt;&gt;</a></th>{/heading_next_cell}
  14.  
  15. {heading_row_end}</tr>{/heading_row_end}
  16.  
  17. {week_row_start}<tr>{/week_row_start}
  18. {week_day_cell}<td class="week_cell">{week_day}</td>{/week_day_cell}
  19. {week_row_end}</tr>{/week_row_end}
  20.  
  21. {cal_row_start}<tr>{/cal_row_start}
  22. {cal_cell_start}<td class="cal_cell">{/cal_cell_start}
  23.  
  24. {cal_cell_content}<div>{day}</div><div><a href="{link}">{link_text}</a></div>{/cal_cell_content}
  25. {cal_cell_content_today}<div class="highlight"><a href="{content}">{day}</a></div>{/cal_cell_content_today}
  26.  
  27. {cal_cell_no_content}<div>{day}</div>{/cal_cell_no_content}
  28. {cal_cell_no_content_today}<div class="highlight">{day}</div>{/cal_cell_no_content_today}
  29.  
  30. {cal_cell_blank}&nbsp;{/cal_cell_blank}
  31.  
  32. {cal_cell_end}</td>{/cal_cell_end}
  33. {cal_row_end}</tr>{/cal_row_end}
  34.  
  35. {table_close}</table>{/table_close}
  36. ');
  37.  
  38. $this->load->library('My_Calendar', $prefs, 'cal');
  39.  
  40. $data = array(
  41. 3 => array(
  42. array('link_text' => 'Yahoo', 'link' => 'http://www.yahoo.com')
  43. ),
  44. 7 => array(
  45. array('link_text' => 'Google', 'link' => 'http://www.google.com')
  46. )
  47. );
  48.  
  49. $this->data['cal'] = $this->cal->generate('','',$data);
  50. $this->load->view('head', $this->data);
  51. $this->load->view('body_schedule', $this->data);
  52. $this->load->view('foot');
  53. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.