What would be the cleanest way to route URLs to functions and return only the HTML output from those functions (a.k.a. the menu callback)?
If I use hook_menu()
the string that's returned will be the HTML within the rest of the site. I want the page to display only the string returned from the menu callback.
Should I use drupal_set_header()
in the same way drupal_json()
does? Is this not inefficient having fully bootstrapped Drupal, and then changing the header at the last minute?
I want the fastest code path possible since this is going to be for widgets on external sites. I could start with a standalone .php file and bootstrap what I need but the hook_menu routing is nice.
How should you do this?