[eluser]Skoobi[/eluser]
Cheers for the reply... After reading your reply i realised what was wrong :/ i was catching the wrong segments!!!!
Heres my controller for the show calendar. The issue i had was :
Code:
if ($this->uri->segment(5)) {
$year= $this->uri->segment(4);
$month = $this->uri->segment(5);
}
The segments were 4,3,4 which was the admin/app_cal/show and not the segments after that for the date.
The next issue
im getting is its linking forwards to the next month on the calendar but when i try to go back the uri adds another year so its /admin/app_cal/show/2014/2014/04
Code:
public function show(){
if ($this->uri->segment(5)) {
$year= $this->uri->segment(4);
$month = $this->uri->segment(5);
} else {
$year = date("Y", time());
$month = date("m", time());
}
$tpl = '{table_open}<table border="1" cellpadding="15"cellspacing="1">{/table_open}
{heading_row_start}<tr>{/heading_row_start}
{heading_previous_cell}<th><a href="{previous_url}"><<</a></th>{/heading_previous_cell}
{heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell}
{heading_next_cell}<th><a href="{next_url}">>></a></th>{/heading_next_cell}
{heading_row_end}</tr>{/heading_row_end}
{week_row_start}<tr>{/week_row_start}
{week_day_cell}<td>{week_day}</td>{/week_day_cell}
{week_row_end}</tr>{/week_row_end}
{cal_row_start}<tr>{/cal_row_start}
{cal_cell_start}<td>{/cal_cell_start}{cal_cell_content}'.anchor('app_cal/create/'.$year.'/'.$month.'/{day}', '+').' <a href="{content}">{day}</a>{/cal_cell_content}
{cal_cell_content_today}<div class="highlight">'.anchor('app_cal/create/'.$year.'/'.$month.'/{day}', '+').'<a href="{content}">{day}</a></div>{/cal_cell_content_today}
{cal_cell_no_content}'.anchor('app_cal/create/'.$year.'/'.$month.'/{day}', '+').' {day}{/cal_cell_no_content}
{cal_cell_no_content_today}<div class="highlight">'.anchor('app_cal/create/'.$year.'/'.$month.'/{day}', '+').'{day}</div>{/cal_cell_no_content_today}
{cal_cell_blank} {/cal_cell_blank}
{cal_cell_end}</td>{/cal_cell_end}
{cal_row_end}</tr>{/cal_row_end}
{table_close}</table>{/table_close}';
$prefs = array(
'start_day' => 'monday',
'month_type' => 'long',
'day_type' => 'short',
'show_next_prev' => TRUE,
'next_prev_url' => '',
'template' => $tpl,
);
$this->load->library('calendar', $prefs);
$appointments = $this->App_cal_model->get_appointments($year, $month);
$data = array();
foreach ($appointments->result() as $row) {
$data[(int)date("d",$row->app_date)] = $row->app_url;
}
$this->data['cal_data'] = $this->calendar->generate($year,$month, $data);
// Load view
$this->data['subview'] = 'admin/app_cal/show';
$this->load->view('admin/_layout_main', $this->data);
}
Any ideas why this is???
Cheers
Chris