Ning: Entuk lan Format API Pitakon

Pungkasan minggu iki, aku nggarap proyek sing pengin narik konten saka kabeh penjuru Indiana sing luwih cilik (dibangun karo Ning) dadi kaca tengah. Ing Festival Frisian Indianapolis lagi siyap lan Cilik Indiana pengin mbantu promosi acara kasebut.

API Ning dudu sing paling teratur, lan dokumen lan aplikasi conto pancen kurang. Amarga ana alangan wektu kanggo mbukak kaca lan mlaku, aku kudu luwih cepet tinimbang nggawe solusi sing tepat. Kaca saiki bisa digunakake, nanging kode hard tanpa keluwesan. Bisa uga ana validasi tambahan konten uga (contone: njamin url blog diformat beda karo url forum, lsp.).

Cara Ning API bisa digunakake yaiku mesin pitakon sing bisa entuk asil sing dibutuhake ing feed RSS. Kita njaluk supaya sapa wae sing blog, miwiti diskusi, utawa ngunggah foto khusus menehi tag isi indyfringe-2008. Iki ngidini aku nggawe alamat feed khusus sing njupuk kabeh konten (kanthi mudhun miturut tanggal diterbitake kanthi URL ing ngisor iki:

http://smallerindiana.ning.com
/xn/atom/XNUMX/tag(value=%XNUMXindyfringe-XNUMX%XNUMX)/content?order=published@D

Within the page, I then extract and organize the data on the page using the Magpie RSS Class for PHP. Click to zoom in on the code or you can view or download it.

fetch rss ningAPI and Format it” width=”XNUMX″ height=”XNUMX″ class=”aligncenter size-medium wp-image-XNUMX″ />

There's some interesting functionality here. Thanks to Tyler Ingram (from my high school home of Vancouver!) who assisted with formatting the dates correctly via Twitter.

Once again, it's not the cleanest code and it's also not broken up properly into functions for quick use – but it works. 🙂 I replace the links so the urls are properly directed, I remove any HTML tags from the included content, I format the date, and I limit the number of words displayed so that the page result looks like this:

Some Babble on the Babbling Banshee Like with my review of Good Grief, Sidney there were bits to like and bits not… XNUMX/XNUMX XNUMX:XNUMX AM

iki API is a huge benefit because you can actually subscribe to content and topics in Ning networks that are specifically tagged, or you can integrate an external website with Ning content. I just hope that Ning works on the sample applications and documentation so folks like me can do this without spending so much time!

Apa sampeyan mikir?

Situs iki nggunakake Akismet kanggo ngurangi spam. Sinau babagan proses data sampeyan.