tags:

views:

41

answers:

3

I have a specific kind of node in which the user must paste FULL html into the body field. E.g. html including the html, head and body tags. Apparently, Drupal's version of "full html" is infact not "full html" as it strips out these tags.

How can I circumvent Drupal?

+2  A: 

I solved this by using the nodeapi hook in a module in a fairly brutal way:

function your_module_name_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {   
    if($node->type == "the_relevant_type" && $op == "view") {
        echo $node->body;
        exit(); // stick that in your pipe and smoke it, Drupal
    }
}
Finbarr
The head and body tags don't get stripped, they get sanitized.I'd be curious to know what you're trying to accomplish by putting a full HTML page into a node. I suspect there's a more Drupal-way of doing what you're trying to accomplish.
Matt V.
A client has a huge number of static html pages that are structured in numerous different ways, and currently only wishes to modernise parts of their website. The decision taken is that these pages will remain static, and will not have any of Drupal's normal widgetry present on them. It would be a huge undertaking to begin creating different page.tpl.php files for all of these different types of page. These static html pages are to reside in the same directory as Drupal, and this node type and code will allow crucial pages such as the index.html file to avoid conflicting with Drupal's routing.
Finbarr
+1 for the pipe comment... even though this *is* quite brutal :)
Pekka
Whoa. Why not just run something like the import_html module and suck it in to Drupal that way? Combined with normal Full HTML it should keep everything you need. Only now you can use the Drupal headers.
Grayside
A: 

Can't you make use of normal nodes and static page specific blocks?

jpluijmers
A: 

You're not really circumventing Drupal; you're getting all of the overhead of Drupal with almost none of the benefit. To really circumvent Drupal, you should not put these static documents in Drupal at all. Drupal's .htaccess is set to only load Drupal when a URL does not match an actual file, so putting your actual files where they are now and adding Drupal where Drupal goes (which shouldn't overlap with .html files at all) will both work better and be easier to implement.

If you really want to dump the HTML in CCK and run a bunch of database queries before outputting static HTML, you could just change the field to plain text.

Scott Reynen
So, what about the index.html file?
Finbarr