EllisLab text mark
Advanced Search
     
Any chance to show 2 months in a view using Calendar class?
Posted: 16 January 2011 03:39 PM
Joined: 2009-11-26
237 posts

hi

Any chance to show 2 months in a view using Calendar class?
The code in the user guide shows only 1 month.

thanks.

 
Posted: 16 January 2011 07:19 PM   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2008-05-02
383 posts
$this->load->library('calendar');

$year 2011;
$month 1;
$data['month_1'$this->calendar->generate($year$month);

$month 2;
$data['month_2'$this->calendar->generate($year$month);

$this->load->view('your_view_name',$data); 


Cristian Gilè

 
Posted: 17 January 2011 03:25 AM   [ # 2 ]   [ Rating: 0 ]
Joined: 2009-11-26
237 posts
Cristian Gilè - 17 January 2011 12:19 AM
$this->load->library('calendar');

$year 2011;
$month 1;
$data['month_1'$this->calendar->generate($year$month);

$month 2;
$data['month_2'$this->calendar->generate($year$month);

$this->load->view('your_view_name',$data); 


Cristian Gilè

That´s pretty simple but works great!

 
Posted: 27 June 2011 06:43 PM   [ # 3 ]   [ Rating: 0 ]
Joined: 2010-11-16
2 posts

Hello, iam doing the same, i have to calendars, but in the second i dont wanna the next and prev links, i try in various ways but dont work, i hope i can get some help thanks.

/**CONTROLER**/
function calendario($year null$month null){

        $this
->load->model('Calendario_Model');
        
$data['calendario'$this->Calendario_Model->generar($year$month,1);
        
        if (empty(
$month)) { $month date("m") + 1;}
        
else               { $month++;}
        
        $data[
'calendario2'$this->Calendario_Model->generar($year$month,2);
        
$this->load->view('calendario',$data);
        
    
}

/**MODEL**/
function cal_config($cal){
        $conf 
= array();
        if(
$cal==1){
            $conf 
= array(
                
'show_next_prev' => true,
                
'next_prev_url'  => base_url() . 'admin/calendario'
            
);
        
}
        else{
            $conf 
= array(
                
'show_next_prev' => false
            
);
        
}

        $url_images 
base_url();
        
$conf['template'='
           {table_open}<table border="0" cellpadding="0" cellspacing="0" class="calendario">{/table_open}

           {heading_row_start}<tr class="mes">{/heading_row_start}

           {heading_previous_cell}<th><a href="{previous_url}"><img src="'
.$url_images.'images/arrow_prev.png"/></a></th>{/heading_previous_cell}
           {heading_title_cell}<th colspan="{colspan}" class="mes">{heading}</th>{/heading_title_cell}.....
          return $conf;
}
function generar($year,$month,$cal){
        $this->load->library('
calendar',$this->cal_config($cal));
        return $this->calendar->generate($year, $month);
    }

/**VIEW*/

<?php echo $calendario;?><br/>
<?php echo $calendario2;?> 

thanks for any help!