Library not working - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Library not working (/showthread.php?tid=70290) |
Library not working - kirasiris - 03-21-2018 I tried to implement a library which allows me to display global data like site name, site logo, etc from the database to all the views without the necessity of passing them via controllers(which I think is time consuming). PHP Code: <?php now in order to put it in my views, I've gotten to do just this: PHP Code: <?php echo $settings['website_name'] ?> This is what I get, two errors, one for the undefined property: Quote:Severity: Notice and one for the function calling in null(is there a way to overwrite this?): Quote:An uncaught Exception was encountered I hope I could make myself clear. Thanks in advance. RE: Library not working - InsiteFX - 03-21-2018 Your missing self or $this on your $settings array PHP Code: // Wrong Also I think I ran into this with my Registry Class and had to make a helper with methods to access the library methods. So if that does not work then you will need to create a helper for the library. Download registry here: Registry for CodeIgniter RE: Library not working - kirasiris - 03-21-2018 (03-21-2018, 04:07 AM)InsiteFX Wrote: Your missing self or $this on your $settings array Yes, you were right!. Thanks! |