Welcome Guest, Not a member yet? Register   Sign In
Next/Previous Links in Calendar Class
#11

[eluser]toymachiner62[/eluser]
what is the error you are receiving? and what is the URL before and after you click the prev/next button?
#12

[eluser]toymachiner62[/eluser]
I see an error in my snippet. See updated version.

Code:
$temp = array (
               'start_day'      => 'sunday',
               'month_type'     => 'long',
               'day_type'       => 'short',
               'show_next_prev' => TRUE,
               'next_prev_url'  => site_url('controller/method')  // set your own url here. You will need the URL helper loaded to use site_url().
             );
#13

[eluser]lrussell810[/eluser]
http://www.discipleshipplanning.com/planner then try and click on the prev/next links
#14

[eluser]toymachiner62[/eluser]
it's because it's not loading your method in the url name. It should be http://www.discipleshipplanning.com/plan...YEAR/MONTH. What are you using for the url for next_prev_url?
#15

[eluser]lrussell810[/eluser]
This is in my controller now

Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Planner extends CI_Controller {
    
    function index($year = false, $month = false)
    {
        // if &year; and $month are false, set them using PHP's native date function.
        if( $year === FALSE ) $year = date( 'Y' );
        if( $month === FALSE ) $month = date( 'm' );
        
        $temp['template'] = '
        
           {table_open}<table class="planner">{/table_open}
        
           {heading_row_start}<tr>{/heading_row_start}
        
           {heading_previous_cell}<th>< href="{previous_url}">&lt;&lt;</a></th>{/heading_previous_cell}
           {heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell}
           {heading_next_cell}<th>< href="{next_url}">&gt;&gt;</a></th>{/heading_next_cell}
        
           {heading_row_end}</tr>{/heading_row_end}
        
           {week_row_start}<tr>{/week_row_start}
           {week_day_cell}<th class="day_header">{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}<span class="day_listing">{day}</span>&nbsp;&bull; {content}&nbsp;{/cal_cell_content}
           {cal_cell_content_today}<div class="today"><span class="day_listing">{day}</span>&bull; {content}</div>{/cal_cell_content_today}
        
           {cal_cell_no_content}<span class="day_listing">{day}</span>&nbsp;{/cal_cell_no_content}
           {cal_cell_no_content_today}<div class="today"><span class="day_listing">{day}</span></div>{/cal_cell_no_content_today}
        
           {cal_cell_blank}&nbsp;{/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'      => 'sunday',
               'month_type'     => 'long',
               'day_type'       => 'short',
               'show_next_prev' => TRUE,
               'next_prev_url'  => site_url('planner/show')  // set your own url here. You will need the URL helper loaded to use site_url().
             );
        
        $data = array(
                3  => 'Pray 3X Daily',
                7  => 'Read 1 Chapter of Romans',
                13 => 'Do 20 Minute Workout',
                26 => 'Study CodeIgniter Libraries'
        );
        
        $this->load->library('calendar', $temp, $prefs);

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

        $this->load->view('plannerview', $vars);
    }
}

/* End of file planner.php */
/* Location: ./application/controllers/calendar.php */
#16

[eluser]toymachiner62[/eluser]
Your prefs is still wrong. Your method is called "index", not "show". Should be

Code:
'next_prev_url'  => site_url('planner/index')
#17

[eluser]lrussell810[/eluser]
Ok, I changed it to index and these are the errors I've received http://www.discipleshipplanning.com/planner

BTW, thank you for all of your help. You have no idea how much I appreciate it.
#18

[eluser]toymachiner62[/eluser]
You still need to load the URL helper. Just add
Code:
$this->load->helper('url')
as the first thing inside your index function of Planner.
#19

[eluser]lrussell810[/eluser]
I Auto-Loaded the URL helper earlier, but I just tried it as the first thing inside of my index function of the controller Planner, but now I have a new error.
#20

[eluser]toymachiner62[/eluser]
Which line is 10?




Theme © iAndrew 2016 - Forum software by © MyBB