Welcome Guest, Not a member yet? Register   Sign In
Loading controllers from a view
#2

[eluser]LuckyFella73[/eluser]
Hi Mike,

you could do something like:
Code:
<?php
function index()
{
    $data['main_content'] = 'portfolio_home';
    $data['db_data_table'] = $this->_listProjects();
    
    $this->load->view('portfolio',$data);
}

function _listProjects(){
    $this->load->library('table');
    $query = $this->db->query("
        SELECT clients.client, project_list.project, project_list.role, project_list.url
        FROM clients, project_list
        WHERE clients.id = project_list.client_id
        GROUP BY clients.client, project_list.project
        ");
        
    return $this->table->generate($query);
}  
?>

and then echo $db_data_table in your view. I never worked with the table
library but that could be the way to go. If you need the same function
in other controllers too you better set up a library or helper.


Messages In This Thread
Loading controllers from a view - by El Forum - 11-23-2010, 07:40 AM
Loading controllers from a view - by El Forum - 11-23-2010, 07:47 AM
Loading controllers from a view - by El Forum - 11-23-2010, 07:53 AM
Loading controllers from a view - by El Forum - 11-23-2010, 08:04 AM
Loading controllers from a view - by El Forum - 11-23-2010, 08:43 AM
Loading controllers from a view - by El Forum - 11-23-2010, 09:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB