Welcome Guest, Not a member yet? Register   Sign In
Help with helpers
#1

[eluser]gmask[/eluser]
Alright so I have this simple db query:
Code:
// Get global settings
$query = $this->db->get('settings');
if ($query->num_rows() > 0)
{
       $row = $query->row_array();
       $settings['site_title'] = $row['title'];
       $settings['site_tagline'] = $row['tagline'];
       $settings['site_location'] = $row['location'];
       $settings['site_comments'] = $row['comments_enable'];
}
Because this information is going to be called in most of my functions, and every single one of my views, I want to stop repeating myself. How can I put it into a helper (if that's even what I should do) to make it so I don't have to repeat the code for all of my functions (which then pass it to the view)?


Messages In This Thread
Help with helpers - by El Forum - 08-31-2010, 01:28 AM
Help with helpers - by El Forum - 08-31-2010, 02:05 AM
Help with helpers - by El Forum - 08-31-2010, 02:50 AM
Help with helpers - by El Forum - 08-31-2010, 03:11 AM
Help with helpers - by El Forum - 08-31-2010, 03:45 AM
Help with helpers - by El Forum - 08-31-2010, 04:04 AM
Help with helpers - by El Forum - 08-31-2010, 04:17 AM
Help with helpers - by El Forum - 08-31-2010, 04:37 AM
Help with helpers - by El Forum - 08-31-2010, 10:02 AM
Help with helpers - by El Forum - 08-31-2010, 12:41 PM
Help with helpers - by El Forum - 08-31-2010, 02:33 PM
Help with helpers - by El Forum - 09-01-2010, 01:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB