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

[eluser]gmask[/eluser]
Hi Met,
I tried what you suggested, but something's gone wrong. My helper:
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed.');

function settings()
{
    // Get global settings
    $CI = & get_instance();
    $query = $CI->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'];
    }
    return $settings;
}

?>
My controller:
Code:
function index()
    {
        $settings = $this->snappy->settings();
        $this->load->view('index', $settings);
    }
But it returns this error:
Quote:A PHP Error was encountered
Severity: Notice
Message: Undefined property: Blog::$snappy

Fatal error: Call to a member function settings() on a non-object in ...\controllers\blog.php on line 22


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