hi!

I´m developing an external facebook-connect application with drupal. The problem I have is that I need to integrate a "tab"-page, that can only display fbml, a facebook specific subset of html, into the users´ facebook profiles. A common drupal page will of course use standard html and also display the whole theme-template, whereas I´d only like the actual content to be displayed.

Can anyone help me?

Thanks
Sören

Comments

nevets’s picture

This use to work in Drupal 5, I am guessing it still does in Drupal 6.

You can create a module with a menu callback (using hook_menu) and have the callback function. The callback function should be able to theme it's output for facebook and at the end, instead of returning the themed output, print the output (which will disable the default page theme).

soerenP’s picture

Thanks, good idea, but: If I print the output, won´t the template stuff be sent as well? you might do it with an exit() after printing the output. But is this method clean?
Or do you mean, that, if I print something, Drupal will notice and will not try to output its theme?

Thanks
Sören

nevets’s picture

Two ways to structure a menu callback, the first will end up in the site's standard theme.

function yourmodule_yourcallback() {
  $output = "hello world";

  // Have Drupal place it in the sites theme
  return $output;
}

This version does not use the site's theme (Drupal forgoes the page theme since the function returns nothing). This approach is used by callbacks that return json.

function yourmodule_yourcallback() {
  $output = "hello world";

  // Output is not placed in the site's theme
  print $output;
}
soerenP’s picture

Wow!
Yeah, thank you!