Not long ago facebook introduced iframe-based page tabs, as opposed to the older FBML-based tabs. The FBML tabs are now deprecated, but until now are the only kind supported by modules/fb/fb_tab.module.

While I dread including large changes and new features in release candidates, which the fb-6.x-3.0 release is supposed to be, I'm seriously considering including this new feature. Without it, there is essentially no support for page tabs, which I think are important.

So here's a massive patch which may or may not make it into the 6.x-dev branch next week. Please test if you can and weigh in as to whether this feature is important to you.

My personal recommendation, if your app needs a tab, is to use this patch and build an iframe tab, as opposed to FBML.

Comments

jackplain’s picture

Category: task » bug
Status: Needs review » Active

Thanks a lot!
The "iframe Tab" feature is very important for application development.

I got a fatal error after patching.
Fatal error: Call to undefined function fb_process() in ../sites/all/modules/fb/fb_tab.module on line 166

I can't find the file "fb.process.inc", which is supposed to be included in fb_tab.module

Damjan Dvorsek’s picture

After patching also in my case something is very wrong. If i go to application, or the page tab, the canvas is balnk and the tab also. Unfortunatly I don't get any error reported, so I can't say where exactly is the problem.

Damjan Dvorsek’s picture

Category: bug » task
Status: Active » Needs review

Ok I check recent log again and I get the following errors reported when I go to application in FB

include_once() [function.include]: Failed opening 'sites/all/modules/fb/fb.process.inc' for inclusion (include_path='.:/opt/bitnami/php/lib/php') in /opt/bitnami/apps/drupal/htdocs/sites/all/modules/fb/fb_canvas.module on line 171.

and similar

include_once(sites/all/modules/fb/fb.process.inc) [function.include-once]: failed to open stream: No such file or directory in /opt/bitnami/apps/drupal/htdocs/sites/all/modules/fb/fb_canvas.module on line 171

and the error massages when I visit the application tab on a page

include_once() [function.include]: Failed opening 'sites/all/modules/fb/fb.process.inc' for inclusion (include_path='.:/opt/bitnami/php/lib/php') in /opt/bitnami/apps/drupal/htdocs/sites/all/modules/fb/fb_tab.module on line 155.

and similar

include_once(sites/all/modules/fb/fb.process.inc) [function.include-once]: failed to open stream: No such file or directory in /opt/bitnami/apps/drupal/htdocs/sites/all/modules/fb/fb_tab.module on line 155.

Dave Cohen’s picture

StatusFileSize
new31.88 KB

Here's another attempt to roll the patch. Hopefully this will include the new files (fb.process.inc and fb_tab.js).

Dave Cohen’s picture

StatusFileSize
new31.78 KB

Here's another attempt to roll the patch.

Damjan Dvorsek’s picture

The diff2.diff looks ok, haven't noticed any issues so far.

It fixes my problem http://drupal.org/node/1118238

Thanks

Dave Cohen’s picture

FYI, plan is to get this into D6 branch first, as the 3.0-6.x release is the priority. Will port to D7 after.

Michsk’s picture

The autoheight does not work for the tab pages.

See http://forum.developers.facebook.net/viewtopic.php?id=91526 for more info about tab pages and autoheight.

Michsk’s picture

fb.module @553 add:

  $output .= "<script>";
  $output .= "window.fbAsyncInit = function() {";
  $output .= "FB.init({appId: '".$GLOBALS['_fb_app']."', status: true, cookie: true,";
  $output .= "xfbml: true});";
  $output .= "FB.Canvas.setAutoResize(true);";
  $output .= "FB.Canvas.setSize({ width: 520 });";
  $output .= "};";
  $output .= "(function() {";
  $output .= "var e = document.createElement('script'); e.async = true;";
  $output .= "e.src = document.location.protocol +";
  $output .= "'//connect.facebook.net/en_US/all.js';";
  $output .= "document.getElementById('fb-root').appendChild(e);";
  $output .= "}());";
  $output .= "</script>";
Dave Cohen’s picture

Just add

class="fb_tab-resizable"

to the <body> tag of your tab theme's page.tpl.php. See fb_tab.js for how that is handled.

Don't redifine window.fbAsyncInit as it is already defined in fb.js.

Michsk’s picture

Ok but i use the same page.tpl for tabs and pages, trough a fluid layout.

Is there some way to do a check, i use a custom template for the fb-stuff so i can change everything without altering the website itself. Here you can see what i've done so far with your module http://www.facebook.com/pages/Depressie/115925068466757?sk=app_148285918...

Or can i also add fb_tab-resizable for fb-pages and it will not break anything?

Michsk’s picture

sorry for taking of this thread, if you want i will create a new thread. Using fb_tab-resizable doesnt resize the iframe.

Michsk’s picture

Resize is fixed. Thanks.

berenddeboer’s picture

Ah, D6 only? That's a pity, as I'm developing a tab with Drupal 7. Any chance of a D7 port soon? Would this be hard to do (i.e. is the code very different, or is it just fiddling with api changes)?

Dave Cohen’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Status: Needs review » Patch (to be ported)
Issue tags: -fb3-blocker

My goal is to get the D6 version, 6.x-3.0, released first. Then a D7 version will follow. Any help upgrading the 6.x modules is appreciated.

marking this as fixed for D6, but flagging that it needs to be ported to D7.

star-szr’s picture

Subscribe

trevorsheridan’s picture

Subscribe

brettev’s picture

Subscribing

brettev’s picture

After subscribing, I have a question about ultimate functionality here. It looks like from other discussions, as well as other apps, that the tabs are supposed to be single pages. The app I'd like to build would be essentially a canvas page, but have it be within a tab, so we maintain the left navigation items of a fan page. I've attempted to do this with just pointing my app's tab url to the fb_cb/APPID url, but then some of the redirects and links go over to the app's canvas page, which loses the nav.

Is the end product of having iframe tabs going to allow me to control links and keep them within the tab of the fan page, or is there another way to handle a site within a tab of an iframe, keeping the links so they don't bounce to the app's canvas page?

I know we could probably just create a separate site that has a 520px wide theme, but we'd like to have the only difference between the tab and the site be the theme, so the same menu items and features are available on the site as well as the fb tab.

Hopefully this isn't too winded. Any direction here would be great! Thanks in advance!

Michsk’s picture

your question should be a new issue.

gagarine’s picture

What's up with the port to D7?