Welcome Guest, Not a member yet? Register   Sign In
Questions regarding <dl> in CI.
#15

[eluser]Aken[/eluser]
In my opinion, based on that model function you showed, you might as well be making the DB call directly. Passing SEVEN variables is crazy. Yes, if you have a handful functions that each reports some specific information even in a similar fashion, I would much prefer that over your method. You'd be doing "$this->model->functionTwo();" instead of "$this->model->function($blah, $blah, $blah, $blah);". It's far easier to manage.

You could even have a private function inside your model that does the actual DB retrieve, and just define some variables for each situation in the rest of your functions.

Code:
function getDB1()
{
    $params = array(
        'column1' => 'this',
        'column2' => 'this',
        'table1' => 'this',
        'table2' => 'this'
    );
    
    return $this->parse($params);
}

function getDB2()
{
    $params = array(
        'column1' => 'this',
        'column2' => 'this',
        'table1' => 'this',
        'table2' => 'this'
    );
    
    return $this->parse($params);
}

private function parse($params)
{
    $this->db->select($params['table1'].'.'.$params['column1'].' AS when');
    $this->db->select($params['table2'].'.'.$params['column2'].' AS event');
    
    return $this->db->return_array();
}


Messages In This Thread
Questions regarding <dl> in CI. - by El Forum - 09-03-2009, 02:41 PM
Questions regarding <dl> in CI. - by El Forum - 09-03-2009, 04:21 PM
Questions regarding <dl> in CI. - by El Forum - 09-03-2009, 06:44 PM
Questions regarding <dl> in CI. - by El Forum - 09-03-2009, 11:43 PM
Questions regarding <dl> in CI. - by El Forum - 09-04-2009, 01:40 AM
Questions regarding <dl> in CI. - by El Forum - 09-04-2009, 01:46 AM
Questions regarding <dl> in CI. - by El Forum - 09-04-2009, 02:10 AM
Questions regarding <dl> in CI. - by El Forum - 09-04-2009, 02:12 AM
Questions regarding <dl> in CI. - by El Forum - 09-04-2009, 02:19 AM
Questions regarding <dl> in CI. - by El Forum - 09-04-2009, 03:10 AM
Questions regarding <dl> in CI. - by El Forum - 09-04-2009, 05:38 AM
Questions regarding <dl> in CI. - by El Forum - 09-07-2009, 02:30 AM
Questions regarding <dl> in CI. - by El Forum - 09-07-2009, 05:38 AM
Questions regarding <dl> in CI. - by El Forum - 09-07-2009, 05:51 AM
Questions regarding <dl> in CI. - by El Forum - 09-07-2009, 06:24 AM
Questions regarding <dl> in CI. - by El Forum - 09-07-2009, 06:58 AM
Questions regarding <dl> in CI. - by El Forum - 09-07-2009, 08:11 AM
Questions regarding <dl> in CI. - by El Forum - 09-07-2009, 11:05 AM
Questions regarding <dl> in CI. - by El Forum - 09-07-2009, 05:08 PM
Questions regarding <dl> in CI. - by El Forum - 09-08-2009, 12:45 AM
Questions regarding <dl> in CI. - by El Forum - 09-08-2009, 01:04 AM
Questions regarding <dl> in CI. - by El Forum - 09-08-2009, 03:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB