phpFlickr as a Library |
[eluser]Unknown[/eluser]
I'm new to CI and I've been fooling around with it. I really like what I see but i was wondering if I could get some help. I've been trying to load the phpFlickr class as a lib and i keep on getting the "Unable to load the requested class: phpflickr". It's in the libraries folder. I've tried passing the params in different ways but no luck. This is the way i'm loading it in my controller Code: $params = array('api_key' => '<MyAPI-KEY>', 'secret' => NULL, 'die_on_error' => 'false' ); Can anybody see what i'm doing wrong. Thanks Rik
[eluser]gerben[/eluser]
I had the same problem, but solved it by hardcoding my API-key in the class: function phpFlickr ($api_key = '<MY API KEY>', $secret = NULL, $die_on_error = false) Not the most elegant way, but it works. Also make sure the PEAR-library folder is in your libraries folder, otherwise phpFlickr won't find it.
[eluser]bugboy[/eluser]
after looking at this i still personally get the phpFlickr class to load i get An Error Was Encountered Unable to load the requested class: phpflickr I've hand coded my api into the class to see if that works with no joy any ideas
[eluser]bugboy[/eluser]
I forgot to put a capital letter on the front of the class So it loads now but i'm not getting this. Severity: Notice Message: Undefined property: Flickr_test::$phpFlickr Filename: controllers/flickr_test.php Line Number: 18 Fatal error: Call to a member function photos_getRecent() on a non-object in /home/fhlinux162/o/our-atelier.co.uk/user/htdocs/application/controllers/flickr_test.php on line 18 I'm uing the example the phpFlickr gives
[eluser]Chris Newton[/eluser]
in your controller are you calling a method from the library? If so, you'll need to call it like so: $this->phpflickr->photos_getRecent();
[eluser]bugboy[/eluser]
right it was because i was using so you were right ha ha ha ![]() Code: $this->phpFlickr->photos_getRecent(); instead of Code: $this->phpflickr->photos_getRecent(); Now thats working i'm not getting anything back at all which is now my next challange. posted code Code: function index() Its now throwing this error but i understand its because the foreach loop is empty A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: controllers/flickr.php Line Number: 20
[eluser]Chris Newton[/eluser]
So nothing happens when you var_dump it... nothing's returned? I guess the first thing I'd try is running the library outside of CodeIgniter and see if I get any traction.
[eluser]Unknown[/eluser]
I had almost the same problem... i just found out, that the $params are not given correctly. So i tried this: Code: $params['api_key'] = '<MY_API_KEY>'; okey... i had to set the apikey and the secret twice... but this just works out fine for me. =) |
Welcome Guest, Not a member yet? Register Sign In |