Welcome Guest, Not a member yet? Register   Sign In
Any chance to show 2 months in a view using Calendar class?
#1

[eluser]chefnelone[/eluser]
hi

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

thanks.
#2

[eluser]Cristian Gilè[/eluser]
Code:
$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è
#3

[eluser]chefnelone[/eluser]
[quote author="Cristian Gilè" date="1295241549"]
Code:
$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è[/quote]

That´s pretty simple but works great!
#4

[eluser]AkSuicide[/eluser]
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.

Code:
/**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*/

&lt;?php echo $calendario;?&gt;<br/>
&lt;?php echo $calendario2;?&gt;

thanks for any help!




Theme © iAndrew 2016 - Forum software by © MyBB