Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14114

Add custom class to events in codeigniter

$
0
0
Hi,

I am using codeigniter calendar library. I am trying to add a custom class to only the days that have a event.

I tried this 


PHP Code:
{cal_cell_start_today}<td class="test">{/cal_cell_start_today


But only adds it on current day.

How can I add a custom class to only the days that have events.

Thank you for your time.

PHP Code:
<?php

class Events extends CI_Controller {

    public function 
__construct() {
        
parent::__construct();
    }

    public function 
index() {

    }

    public function 
calendar($year ''$month '') {
        
$this->load->model('events_model');

        
$prefs = array(
     
       'start_day' => 'monday',
     
       'month_type' => 'long',
     
       'day_type' => 'short',
     
       'show_next_prev' => FALSE,
 
           'next_prev_url' => base_url('welcome')
        );

        
$prefs['template'] = '
        {table_open}<table class="table">{/table_open}

        {week_row_start}<tr>{/week_row_start}
        {week_day_cell}<td class="week_day">{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_start_today}<td class="test">{/cal_cell_start_today}
        {cal_cell_start_other}<td class="other-month">{/cal_cell_start_other}
        {cal_cell_content}<p>{day}</p><p>{content}</p>{/cal_cell_content}
        {cal_cell_content_today}<div class="highlight"><a href="{content}">{day}</a></div>{/cal_cell_content_today}

        {cal_cell_no_content}{day}{/cal_cell_no_content}
        {cal_cell_no_content_today}<div class="highlight">{day}</div>{/cal_cell_no_content_today}

        {cal_cell_blank}&nbsp;{/cal_cell_blank}

        {cal_cell_other}{day}{/cal_cel_other}

        {cal_cell_end}</td>{/cal_cell_end}
        {cal_cell_end_today}</td>{/cal_cell_end_today}
        {cal_cell_end_other}</td>{/cal_cell_end_other}
        {cal_row_end}</tr>{/cal_row_end}

        {table_close}</table>{/table_close}
        '
;

        
$this->load->library('calendar'$prefs);

        if (!
$year) {
            
$year date('Y');
        }
        if (!
$month) {
            
$month date('m');
        }

        
$cdata $this->events_model->geteventevent($year$month);

        
$data['calendar'] = $this->calendar->generate($year$month$cdata);

        return 
$this->load->view('default/template/events/calendar'$data);
    }


Viewing all articles
Browse latest Browse all 14114

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>