Welcome Guest, Not a member yet? Register   Sign In
Efficient way of handling Tasks and ToDos
#2

[eluser]Aken[/eluser]
I would create a single private function that does all the work, that include a single flag of which item you are using. Then two public functions, that only call the private one with the appropriate flag.
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class App extends CI_Controller {

    public function __construct()
    {
        parent::__construct();
    }
    
    public function index()
    {
        // Something
    }
    
    public function todo()
    {
        $this->_load('todo');
    }
    
    public function tasks()
    {
        $this->_load('tasks');
    }
    
    private function _load($task)
    {
        // All your code goes here.
    }

}


Messages In This Thread
Efficient way of handling Tasks and ToDos - by El Forum - 07-18-2011, 11:43 AM
Efficient way of handling Tasks and ToDos - by El Forum - 07-18-2011, 11:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB