I just updated the newest release and my theme on the facebook canvas page is not pulling any style sheets at all. using firebug I am able to see that it is referencing:

http://external.ak.fbcdn.net/fbml_static_get.php?src=http%3A%2F%2Fmy.hir...

but there is nothing in the sheet, the same with all of the local drupal sheets like node.css and system.css

CommentFileSizeAuthor
#3 fb shot.png131.21 KBpoundy

Comments

Dave Cohen’s picture

I've seen that, too. Error 500 from facebook instead of any content.

I really think its a bug on facebook's side. I don't see how the theme could cause this problem itself.

Facebook parse, munges, and stores its own copy of your apps stylesheets. If that fails, the canvas pages are hosed. I don't have a workaround at the moment.

Dave Cohen’s picture

Here's an attempt to include the styles with each page, a workaround....


function _fb_fbml_get_styles() {    
  $inline = TRUE;

  if ($inline) {
    // Include the styles directly in the page.
    $css = drupal_add_css();
    $styles = "<style>\n";
    foreach ($css['all'] as $type => $files) {
      foreach ($files as $file => $x) {
        $styles .= "\n\n/** $file **/\n";
        //$styles .= htmlentities(file_get_contents($file, TRUE));
        $styles .= file_get_contents($file, TRUE);
      }
    }
    $styles .= "\n</style>\n";
  }
  else {
    // On profile tabs, we must preprocess.  Facebook limits number of files.
    $preprocess_css = $conf['preprocess_css'];
    if (fb_is_profile_tab()) {
      $conf['preprocess_css'] = TRUE;
    }
    $styles = drupal_get_css();
    $conf['preprocess_css'] = $preprocess_css; // Restore original value
  }
  
  return $styles;
}

First add that function to template.php, then edit preprocess_page so it does this:


    $vars['styles'] = _fb_fbml_get_styles();

Sorry I don't have a proper patch.

poundy’s picture

StatusFileSize
new131.21 KB

Dave,
Thank you so much for your prompt response. I applied the code but was unable to load the style sheets still. its possible I didn't apply the patch to the right place. I added the function to the bottom of the template page and I placed the preprocess to the else under the preprocess_page. I included a screen shot of what is coming up on my app, as you can see the info is being pulled to the app its just not getting styled.

also on a side note, I sent you a direct message monday about a potential feature that my company would like to incorporate into Drupal for facebook. How is the best way to get with you about this sub module?

jaypark’s picture

dave, i'm having the same issue with fb_fbml, beta11. when following the munged css link fb returns: "Invalid parameter: Unknown error"

i agree with you - i applied a different method to put css inline, it worked for several page reloads then this morning, after i recheck the fb app, styles aren't included. facebook was also randomly returning hex strings for status updates last fall [like it was outputting the first n values of an image file].

jaypark’s picture

should've also noted that adding _fb_fbml_get_styles() from http://drupal.org/node/772514#comment-2851618 above, and replacing

$vars['styles'] = drupal_get_css();
with
$vars['styles'] = _fb_fbml_get_styles();

still produces the invalid parameter error... the styles aren't being honored.

phpepe’s picture

Hi guys,
I had the same "Invalid tag link" error, And appling Dave workaround, works fine now.

Just another tunning to do, in order to be able to render "styles_fbml.css" correctly:

Inside "fb_fbml_preprocess_page" function, instead of

<?php
  drupal_add_css(path_to_theme() . '/styles_fbml.css', 'theme','fbml');
?>

You must change it to:

<?php
  drupal_add_css(path_to_theme() . '/styles_fbml.css', 'theme');
?>

Just ommiting the 3rd param. because #comment-2851618 function iterates over '$css['all']'...