It should work with javascript as normal (at least a quick test page did that included jquery from Google's CDN and then operating on the dom).
You're right that drupal_http_request gets everything including any html, css etc and you're at the mercy of how well-formed they are. You could either create versions of the pages which just output the exact html you want (e.g. ignoring <html> and <head> tags) or you could manipulate it back in drupal (explode on "body>"?). You could optionally run it through something like HTML Purifier (can you run stuff functionally through Drupal's filters?) if you don't trust your content.
Anyway - it was just a thought based on what could be a quick and dirty solution.
Message: 3 Date: Tue, 21 Jun 2011 16:06:18 -0700 From: "Metzler, David" metzlerd@evergreen.edu Subject: Re: [support] Integrating completely unrelated pages into Drupal To: support@drupal.org Message-ID: 52177C930FA90F4D9888B0343FDB79FB0277E52D@birch.evergreen.edu Content-Type: text/plain; charset="us-ascii"
This is a clever idea, but be warned that the embedded javascript is not likely to render or "include" properly, and unless you run this through an html filter likely to cause malformed html. IIRC the data property returned includes all of the data including headers, html head, body tags css references etc.
Someone please correct me if I am wrong.
Dave
From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of DTH Sent: Tuesday, June 21, 2011 3:47 PM To: support@drupal.org Subject: Re: [support] Integrating completely unrelated pages into Drupal
Maybe kludgy, but could be very quick to do depending on your structure: in a custom module:
/**
- Implementation of hook_menu().
*/
function example_menu() {
$items['test/page'] = array(
'title' => 'Test Page Title',
'page callback' => 'test_page',
'access arguments' => array('access content'), 'type'=>MENU_NORMAL_ITEM);
return $items;
}
function test_page(){
$request =drupal_http_request("http://www.example.com/pages/test.php");
return $request->data;}
Date: Tue, 21 Jun 2011 12:29:20 -0500 From: Scott Massey <scott.massey@gmail.com> Subject: [support] Integrating completely unrelated pages intoDrupal To: support@drupal.org Message-ID: <BANLkTik7m+C8r1-MrBdG1OG2zkgvxovQWA@mail.gmail.com mailto:BANLkTik7m%2BC8r1-MrBdG1OG2zkgvxovQWA@mail.gmail.com > Content-Type: text/plain; charset="iso-8859-1"
Hi! I am about 6 months into Drupal and enjoy it immensely. I amputting together a portfolio of some web development I have done and have several pages of data visualiztions using php and a javascript library called Protovis. If I want to bring that into drupal as a page, is there a way to do that? There are library calls, jquery, etc. I am having trouble wrapping my head around how to do it. I would like the pages to be a menu item that opens a page within the drupal site. Here is an example of a page: http://modernamericanman.com/ids499/protovis7.php
Thanks! Scott