SIOC/Neologism/ContentNegotiation

From W3C Wiki


We'll need to support content negotiation in our module in Drupal. Here some stuff.

Ideas

PHP Info

Drupal Info

More information in Drupal.

Implementation

Basic idea

Here some pseudo-code:

$accept = $_SERVER["HTTP_ACCEPT"];
$uri = $_SERVER["REQUEST_URI"];
$preferred = getPreferredContent($accept); if ($preferred == "application/rdf+xml") $newuri = $uri . "/rdfs"; else $newuri = $uri . "/html";
header("HTTP/1.1 303"); header("Location: " . $newuri);

FIXME:: Richard prefers use something similar to the way that mod_content works.

Basic patch in Drupal

Something like:

Index: modules/node/node.module
===================================================================
--- modules/node/node.module	(revision 14)
+++ modules/node/node.module	(working copy)
@@ -685,6 +685,10 @@
  */
 function node_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE) {
   $node = (object)$node;
+  
+  if ($node->type == "vocabulary") {
+    //apply here our patches
+  }
 
   $node = node_build_content($node, $teaser, $page);