[eluser]pengenbelajarCI[/eluser]
Hi, I'm newbie here. And now I'm trying to make a helper. The function in this helper is to show the sitename from config table on database.
Helper
Code:
function sitename($db) {
$db->select('sitename');
$query = $db->get('config');
$row = $query->row();
return $row->sitename;
}
Controller
Code:
class Front extends Controller {
function Front()
{
parent::Controller();
}
function index()
{
$data['sitename'] = sitename($this->db);
$this->load->view('main',$data);
}
}
Is there anyway to make the function in the model just sitename() not sitename($db), so on the controller just type
$data['sitename'] = sitename(); not
$data['sitename'] = sitename($this->db);.
Sorry for my bad English