Passing a second variable into a custom library |
[eluser]WoolyG[/eluser]
Hi, I have a custom library as follows: Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); I'm using the following, which works: Code: <?php What I'm trying to do is to utilise the second parameter of the __construct. How do I do this? I'm trying the following, but it's not working: Code: <?php .. can anyone shed any light on how to access the second parameter of a __construct() when loading a custom library? Thanks! WoolyG
[eluser]vbsaltydog[/eluser]
http://ellislab.com/codeigniter/user-gui...oader.html The first parameter is the library, the second is the array of options, the third is an optional object name. Take your key and other options, put them all in a single array, pass that array as the second parameter, then array_shift the key off of the array in the library constructor.
[eluser]WoolyG[/eluser]
Thanks for that. For what it's worth, a clear method of doing what I need to do is outlined in the first reply to this StackOverflow question: http://stackoverflow.com/questions/34806...er-library I was thinking the User Guide (http://ellislab.com/codeigniter/user-gui...aries.html) might be a little unclear on how to pass multiple parameters to the custom library's __construct.. I'll put forward a suggestion to possibly have it clarified. Thanks. |
Welcome Guest, Not a member yet? Register Sign In |