CodeIgniter Forums
Matchbox RC2 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Matchbox RC2 (/showthread.php?tid=4444)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41


Matchbox RC2 - El Forum - 12-02-2007

[eluser]zdknudsen[/eluser]
Matchbox 0.9.2 has been released. It now features configuration of the determination of what modules are loading what resources. Documentation has been updated accordingly.

Downloads and changelog both found on http://matchbox.googlecode.com/.


Matchbox RC2 - El Forum - 12-02-2007

[eluser]zdknudsen[/eluser]
Matchbox 0.9.2 release note on previous page.

gerben: What you need to do is remove the View library from your modules, and just have it in your standard library folder and autoload it. You then add 'libraries/View' to the $config['callers'] array in the matchbox config file.

Please let me know if it works (it worked for me).


Matchbox RC2 - El Forum - 12-02-2007

[eluser]esra[/eluser]
[quote author="Zacharias Knudsen" date="1196567149"]
esra: Is that a working example, meaning that what he is trying to accomplish is doable?[/quote]

It is a working example for MS 2.4.1 with CI 1.5.4. The same approach should work in Matchbox if the View library is loaded.


Matchbox RC2 - El Forum - 12-03-2007

[eluser]zdknudsen[/eluser]
Ah, I see :-) Where are your View library and views located in that example?


Matchbox RC2 - El Forum - 12-03-2007

[eluser]gerben[/eluser]
Quote:gerben: What you need to do is remove the View library from your modules, and just have it in your standard library folder and autoload it. You then add ‘libraries/View’ to the $config[’callers’] array in the matchbox config file.

Please let me know if it works (it worked for me).

Hi Zacharias, it didn't work when I did it exactly the way you described, BUT... when I added the view library to Matchbox.php, line 50:

Code:
var $_callers = array('MY_Config', 'MY_Language', 'MY_Loader', 'View');

it worked perfectly fine!

So I think for some reason the matchbox.php config file is not loaded. Which is very strange, because I believe CI loads all files in config.php by default.

When I do (in my module):

Code:
print_r($this->config->item('callers'));

It returns nothing.

Anyway, I believe we're getting there. All I need to find out, is why my config isn't loaded.


Matchbox RC2 - El Forum - 12-03-2007

[eluser]zdknudsen[/eluser]
Well CI doesn't load all files in the config folder (at least I'm pretty sure it doesn't). My Matchbox library (and most of the other standard libraries that are loaded before CI is fully loaded like the router, etc.) loads the config file a little differently, so it isn't loaded with $this->load->config and it therefor is not available through $this->config->item either.

Anyways what Matchbox does it merge the array you found yourself with the one in the config file, however apparantly it is not working as it should. I can see that you have added the value 'View'. Was that also what you added to the config file?


Matchbox RC2 - El Forum - 12-03-2007

[eluser]zdknudsen[/eluser]
I just tested it and it appears to merge the two without problems.


Matchbox RC2 - El Forum - 12-03-2007

[eluser]gerben[/eluser]
Quote:I can see that you have added the value ‘View’. Was that also what you added to the config file?

I've tried both 'library/View', as well as 'View', but both don't work. The strange thing is that when I echo something in the config file, it does show up, so apparently the config file IS loaded, but not merged with the $_callers array. Is there anything I can do to test why this is?


Matchbox RC2 - El Forum - 12-03-2007

[eluser]zdknudsen[/eluser]
Strange :S Hm. If you put

echo $this->_callers;

in the end of the Matchbox library's matchbox() method it will print what the array contains after the merge. What does it say?


Matchbox RC2 - El Forum - 12-03-2007

[eluser]gerben[/eluser]
You mean the CI_Matchbox method in Matchbox.php?

It says:

Array ( [0] => MY_Config [1] => MY_Language [2] => MY_Loader )


Sad