I'm going to be inserting some data into a channel via a custom Add-on. It looks as thought I should be using the Channel Entries API in order to do this, which is fine.

What I need to do first though is select some supporting data from some existing Channels. There doesn't seem to be anything in the above API to fetch existing data unless I missed it. What's the best way to accomplish this? I'm happy to use the DB Class, if that's the only way of doing it. I just wanted to check there wasn't a preferred method of doing this before I go re-inventing the wheel!

Any help, gratefully received.


I believe that fetching data from existing channels/entries is just a case of querying the database so it's either straight to the DB class or via CI Active Record It's probably better to use the Active Record class.

| improve this answer | |
  • Thanks Ian. Looks like I was headed in the right direction. – Steve Holland Apr 3 '13 at 7:39

You should look here: https://github.com/objectivehtml/Channel-Data

It might help you.

| improve this answer | |
  • 1
    Yup, I was going to post the same thing. I wrote Channel Data for this exact purpose. It uses the DB class and active record so it's really a step beyond that. – Justin Kimbrell Apr 2 '13 at 18:59
  • Thanks to both of you, this looks like it'll do the trick nicely. – Steve Holland Apr 3 '13 at 7:37
  • 1
    Hey, nice. I wasn't aware of Channel Date but that looks like a time saver. Do you know of any existing extensions which use this Class so I can take a look at and break down a real-world example? – Ian Apr 3 '13 at 8:31
  • I'd be grateful of some examples as well, as I'm struggling to get to grips with it. – Steve Holland Apr 3 '13 at 11:11
  • Ok, I check the repository of the Channel-Data. But there was no info of how to install it. Where to put these files? – Krasimir Dec 2 '13 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.