rendering swf for facebook

Hi All,

First of all , my thanks to everyone who has contributed to this project - I've been developing an application using drupal for facebook, and fb for drupal is a great piece of work.

I'm quite new to Drupal development, but there are a couple of additions I need to make, and would appreciate some community input (and hope that I may be able to contribute some code).

When rendering a swf, fbml requires the use of the <fb:swf tag, so standard swf rendering will obviously fail. I'm working with the flashnode module a which uses swftools. I'm by no means an expert in the drupal framework, so I wonder if anyone might like to weigh in ...

An obvious place to start is a fb_swf module for swftools. Keeping swf rendering encapsulated within swf() function.

But of course the issue is to know when swf() rendering is for facebook. When rendering with a view type, you could just implement this directly explicitly telling swf() to render for facebook.This might be adequate for, say, a simple block rendering of a flashnode node for facebook.

But the general problem as I see it, is how far module code can be reused when standard rendering won’t work in facebook? And a more general problem might be to support rendering for multiple platforms – netvibes/myspace/opensocial etc.

But specifically in the case of rendering a flashnode for drupal without duplicating code from the flashnode module, there’s two instances when swfs are renderer:

1. rendering directly to a node.
2. using the swfnode filter that takes inline [swf:nid= … ] and renders the swf of the specified flashnode specified (by nid).

So brainstorming a couple of approaches:

1) Globally, iis there a mechanism by which the swftools can know that it’s being called from a view that requires drupal? If so the swftool smodule could be modified to deal with this all at once.

2) Or is there a mechanism by which the view can communicate to the rendering module that it’s rendering in a facebook view? Changes could be then made at the flashnode level (and any other view that renders with swftools)

3) I have research to do on the above, but if the architectural implications of the above are too great, then it remains to render entirely within views. For an individual flashnode, I don’t see much to do except re-render the entire node. However for a non-flashnode that used the flashnode filter ([swf, nid= …]) to embed the swf , is might there a way to override this filter with a swf for facebook filter?

4) And of course the final option is a fully custom module, which I may need to do anyway.

Would welcome your thoughts,

Best Regards,
Ian
Subaltern Productions

Ian, You've touched on a

Ian,

You've touched on a real problem here. I agree in particular that swf is just one of many types of content that needs to be handled differently for FBML and I'm of mixed minds on the best way to handle it.

I lean towards the notion of a FBML filter which is active only on canvas pages, and re-writes anything it knows about. This might include flash tags, some javascript, and even re-writing links to files which other fb module code screwed up. (For example, when using an image field you might end up with apps.facebook.com/myapp/files/foo.jpg when you really want mydomain.com/files/foo.jpg).

However even if such a filter worked, it would work only for node an block content. There are other portions of drupal pages which don't use filters. Still it would go a long way. And already the fbml pages use their own filter cache so the fbml filter would not break non-fbml pages.

I appreciate your thoughts. Let me know if you have any revelations.

... or just use cck

Hmm... after some more time looking at views and CCK, it seems there's a much easier option, using formatters with a CCK filed.

May be as simple as adding facebook formatters to the modules used by the Embedded Media Field Module.

Ian