Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter - Facebook Connect Tutorial

I just wrote my first ever CodeIgniter tutorial. It's about using CodeIgniter with Facebook Connect.


Wouldn't mind some feedback.

[eluser]Simian Studios[/eluser]
Firstly, kudos for taking the time to write this up and share - there's a lot of detail there which I'm sure most people will have no problem following along with. Must have taken a fair amount of time to document!

With regards to the writing, I think you could do a fair bit of trimming down to reduce the word count but still keep the tutorial focused and tight. Maybe print it off and go through with a highlighter pen, highlight some wordy phrases and see just how much you can get rid of without making the content meaningless. You'd be surprised!

Regarding the subject itself, I haven't done any Facebook work myself so I can't comment too much on that - when I do come to integrate with Facebook (which should be soon) I'll try running through it and see how I get on. I can't imagine I would have any problems though, you've clearly gone to a lot of trouble to document everything which is good.

I would disagree with you on using a Model over a Library - for me, Models represent "things". I.e. a "page" model, a "customer" model, whereas I don't have "a Facebook" in my system. I can see your logic in terms of Models being data handlers, but seeing as Facebook is external I would put the interface in a separate Library.

Hope that feedback is useful to you - I can't claim to be an accomplished writer myself, I wrote my very first tutorial the other week so I'm in the same position as you really, but that's my 2p anyway, hope it helps. Will drop you a comment on the tut itself as well just to get discussion rolling Smile

Hey Kris,

Thanks for taking the time to read my tutorial and give me feedback. I found your 404 error tutorial on your site's blog, and I'll be looking into implementing your ideas into some of my sites.

I thought I remembered somewhere reading that models can be used for external data sources, but I can't find where I found that. CodeIgniter's user guide states that models are for accessing your database, and CakePHP's documentation states that models can access databases, csv files, iCal events, etc, but no mention of external data sources. I suppose it wouldn't take much effort to turn my model into a library, but I'll leave it for now. Too lazy, for one. And it works how I have it.

And you're probably right about the word count. If and when I create my next tutorial I will have to make it a little more succinct.

Thanks again!

[eluser]Simian Studios[/eluser]
No problem at all - it's what we're here for, right? Smile

I don't think I've seen anyone advocating models for external data, but then I've never really looked for it and it's kinda hard to find any info about it either way. Must brush up on those design patterns! There's probably a design pattern for exactly this situation.. if I find out what it is I'll let you know.

Thanks for the read, I'm working on another to hopefully publish next week.. apparently the learning curve for blogs/tutorials is quite steep so you learn a lot with each new post. Enjoying it so far though!

BRILLIANT! I use Elliot's Facebook library, but was looking for an updated version or was looking to update it myself. But then you turned up and brightened my day. Thanks for this!

Glad to be useful.

Kentimus, thank you.
Worked fine for me.
I have a sugestion...might not be directly related to the tutorial though: code coloring on the website. It would make the code much more readable.
Thanks again. Smile

Thanks for this library Kentimus!

I added a piece of code into getFriendArray function, into foreach:

$friends[$friend['id']] = array(
'name' => $friend['name'],
'picture' => "<img src='https://graph.facebook.com/". $friend['>",

Now, array returns user id, user name and user picture Big Grin

Thanks agains Kentimus!

jorgeguberte: I liked your suggestion, and so I decided to implement it. I tried a few different ways to color the code, but didn't like any of them until I happened on <a href="http://www.simianstudios.com/blog/post/how-to-use-google-code-prettifier-for-quick-and-easy-syntax-highlighting">a tutorial using javascript</a>. Thanks for your suggestion. I think it made a big improvement to my tutorial.

gerardguiu: Thanks for the suggestion. I added it to the last page of my tutorial, and gave you credit. I did modify one line, however. I'm not sure the value you added to the 'picture' would have worked. I changed your suggested code to this:

$friends[$friend['id']] = array(
   'name' => $friend['name'],
   'picture' => "http://graph.facebook.com/".$friend['id']."/picture"

I didn't test it, so I'm not 100% sure that the quotes are escaped correctly, but hopefully this works or is at least easy to debug. Thanks again for your suggestion. I love how useful the CodeIgniter community is.

Oh shit! ups...
I had not noticed that the this post clean the quotes and drop this part of the code:
Problem of the fast reply and not use [ code ]...

Yes, this part is perfectly functional. Yes, the forums are great for sharing ideas and growing Big Grin
pd: sorry for my english. I'm spanish Tongue

Theme © iAndrew 2016 - Forum software by © MyBB