[eluser]srpurdy[/eluser]
I need to work on using pagination more often lol. My problem is I can't seem to pass the per_page or offset from model function, which is getting information from more than 1 database table. So I'm not sure on where I need to put that.
The Controller part where pagination is delcared
Code:
$this->load->library('pagination');
$config['base_url'] = base_url(). 'archives/champs/' . $this->uri->segment(3) . '/';
$config['per_page'] = '5';
$config['uri_segment'] = '4';
$config['num_links'] = '4';
$data['series'] = $this->archives_model->a_show_series($config['per_page'],$this->uri->segment(4));
$config['total_rows'] = count($data['series']->result());
$this->pagination->initialize($config);
The Model Function that I need to pass the per_page and offset
Code:
function a_show_series($num, $offset)
{
$show_series = $this->db
->where('ilr_league.url_league_name', $this->uri->segment(3))
->where('ilr_league.league_id = ilr_series.league_id')
//->where('ilr_series.active', 'N')
->select('
ilr_series.series_id,
ilr_series.series_title,
ilr_series.active,
')
->from('
ilr_series,
ilr_league
')
->order_by('ilr_series.series_id', 'desc')
->get();
return $show_series;
Anyone know where I would need to put $num and $offset?
This function is a part of 2 other functions below that work in conjunction with each other. So I'll post those below as well. As all 3 link together.
Code:
function a_show_seasons()
{
//$this->db->orderby('season_id', 'desc');
//$show_season = $this->db->getwhere('ilr_season', array('url_league_name' => $this->uri->segment(3)), '', '');
$show_season = $this->db
->where('ilr_league.url_league_name', $this->uri->segment(3))
->where('ilr_league.league_id = ilr_season.league_id')
->where('ilr_season.active', 'N')
->select('
ilr_season.season_id,
ilr_season.series_id,
ilr_season.season_title,
ilr_season.slots,
ilr_season.signup_open,
ilr_season.active,
ilr_season.car_name,
ilr_season.entry_fee,
ilr_series.series_title
')
->from('
ilr_season,
ilr_league
')
->order_by('ilr_season.season_id', 'desc')
->join('ilr_series', 'ilr_series.series_id = ilr_season.series_id')
->get();
return $show_season;
}
function a_show_events()
{
$show_events = $this->db
->where('ilr_league.url_league_name', $this->uri->segment(3))
->where('ilr_league.league_id = ilr_events.league_id')
->where('ilr_league.league_id = ilr_season.league_id')
->where('ilr_series.active', 'N')
->where('ilr_season.active', 'N')
->where('ilr_events.track_id = ilr_tracks.track_id')
->select('
ilr_events.schedule_id,
ilr_events.league_id,
ilr_events.user_id,
ilr_events.event_title,
ilr_events.season_id,
ilr_events.track_id,
ilr_events.event_date,
ilr_events.time,
ilr_season.season_title,
ilr_season.season_id,
ilr_season.series_id,
ilr_series.series_title,
ilr_series.series_id,
ilr_tracks.track_name,
ilr_tracks.config
')
->from('
ilr_season,
ilr_tracks,
ilr_league
')
->order_by('ilr_events.event_date', 'asc')
->join('ilr_series', 'ilr_series.series_id = ilr_season.series_id')
->join('ilr_events', 'ilr_events.season_id = ilr_season.season_id')
->get();
return $show_events;
}
Thanks
Shawn