• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.