Forums

#1 2009-02-22 21:04:32

spyderman4g63
Member
Registered: 2008-12-06
Posts: 14

No decent feed tutorials

I am having a hard time understanding feed templates. I can't find any tutorials that actually work. I have tried to register feed templates but I keep getting errors when trying to ad a new {*tag*}. The wiki isn't helpful at all.

Does anyone have a link to a decent walk through of how to set these up?


I have gotten to the point that I do not get an error, but the only output I get is the word array. Can someone help me?

This is what I am trying to do:
{*actor*} likes one line templates. {*item*}

But I hate json so that is probably where the problem is:

sample template data:
{"images":[{"src":"http://pad.thedigitalmovement.com/_blaise/2007-06-15-dgen-breakfast.jpg", "href":"http://www.facebook.com"}, {"src": "http://pad.thedigitalmovement.com/_blaise/2007-06-13-roger-waters.jpg", "href":"http://www.facebook.com"}],"item":[{"text":"hatejson","href":"http://google.com"}]}

outputs:
Spyderman4g63 likes one line templates. Array.  12:07am

Ok I have part of it working.

{"images":[{"src":"http://pad.thedigitalmovement.com/_blaise/2007-06-15-dgen-breakfast.jpg", "href":"http://www.facebook.com"}, {"src": "http://pad.thedigitalmovement.com/_blaise/2007-06-13-roger-waters.jpg", "href":"http://www.facebook.com"}],"item":"text"}

outputs:
Spyderman4g63 likes one line templates. text.  12:07am

Now how to call this from php I do not know.

Last edited by spyderman4g63 (2009-02-22 21:15:15)

Offline

 

#2 2009-02-22 21:49:41

SidK
Member
Registered: 2007-10-16
Posts: 215

Re: No decent feed tutorials

There's plenty of documentation and threads that touch on this topic.

First, register the feed template for your application at http://developers.facebook.com/tools.php?feed. I see you have already been testing there - once you register it, you will be given a Template Bundle ID.

Now all you have to do is use the API to pass on the tokens ( just 'item' and 'images' in your case ) and publish the feed story.

Code:

$tokens = array('item'=>'text', 
                'images'=>array(0 => array('src'=>'http://pad.thedigitalmovement.com/_blaise/2007-06-15-dgen-breakfast.jpg', 
                                            'href'=>'http://www.facebook.com'),
                                1=>array('src'=>'http://pad.thedigitalmovement.com/_blaise/2007-06-13-roger-waters.jpg', 
                                            'href'=>'http://www.facebook.com')
                                ) 
                );

$facebook->api_client->feed_publishUserAction(<your template bundle id>, $tokens);

I have not tested the code. If you encounter any errors, use json_decode($tokens) to test whether or not the array converts exactly to the JSON data you have above.

Last edited by SidK (2009-02-22 21:50:41)


Collager | Say NO to IE6 - Make a Stand

Offline

 

#3 2009-02-22 22:33:18

spyderman4g63
Member
Registered: 2008-12-06
Posts: 14

Re: No decent feed tutorials

I have the template setup and can post the single line.

How do I get the user array for the full stories?


edit:


I decided to use fql, but I am getting an error:

$friends =    $facebook->api_client->fql_query("SELECT uid2 FROM friend WHERE uid1 = $fb_user_id");

'An invalid target was specified: Array. The target must be a valid Facebook user id and be friends with the actor.'

this is because all I am passing is 'array'.

Last edited by spyderman4g63 (2009-02-22 22:57:29)

Offline

 

#4 2009-02-22 23:29:02

spyderman4g63
Member
Registered: 2008-12-06
Posts: 14

Re: No decent feed tutorials

OK i got everything working using:

$facebook->api_client->friends_get($fb_user_id);


However I see another problem. I am calling this through ajax. if I go directly to the site it works fine, but when I use the fbajax it doesn't. I know the ajax call is working because it returns a value.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson