[eluser]vmirjamali[/eluser]
Essentially just like the header says my coder currently coding with CI has around 2k of lines in main.php and didn't seperate them, here's a snipit:
Code:
function index() {
$this->load->model('mdlanime');
$this->load->model('mdlepisode');
$this->load->helper('url');
$headerData['title'] = 'Watch Anime Online for Free - Anime Episodes, Anime Shows, and Anime Movies all for Free';
$pageData['latestReleases'] = $this->mdlepisode->GetLatestReleases();
$pageData['topshows'] = $this->mdlanime->GetPopular(2, 0);
$pageData['recentcompleted'] = $this->mdlanime->GetRecentCompleted();
$this->load->view('vw_header', $headerData);
$this->load->view('vw_index', $pageData);
$this->load->view('vw_divider');
$this->load->view('vw_sidebar');
$this->load->view('vw_footer');
$this->output->cache($this->config->item('cacheTime'));
}
function sidebar() {
session_start();
$this->load->helper('url');
if ($this->vbuser->info['userid'] > 0 && !isset($_SESSION['points'])) {
$this->load->model('mdluserpoints');
$_SESSION['points'] = $this->mdluserpoints->Get();
}
if ($this->vbuser->info['userid'] > 0) {
$this->vbuser->create_session($this->vbuser->info['userid']);
}
$this->load->view('vw_sidebar');
}
function login() {
$headerData['title'] = 'Watch Anime Online for Free - Anime Episodes, Anime Shows, and Anime Movies all for Free';
$pageData['message'] = '';
$pageData['loggedIn'] = false;
// Process login
if (isset($_POST['login'])) {
// Set field requirements
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'username', 'trim|required|min_length[1]|max_length[100]');
$this->form_validation->set_rules('password', 'password', 'trim|required|min_length[1]|max_length[100]');
if ($this->form_validation->run() == true &&
$userid = $this->vbuser->is_valid_login($_POST['username'], $_POST['password'])) {
$this->vbuser->create_session($userid);
$pageData['loggedIn'] = true;
}
else {
// Failed login
$pageData['message'] = 'Invalid username or password.';
}
Is that something needed in CI or is it bad coding practice as i do need scalability with my site? I heard that in other frameworks you can split the controller to many files, so any ideas? Thanks