SIOC/Neologism/ContentNegotiation
(Redirected from SIOC/Neologism/ContentNegotiationDrupal)
We'll need to support content negotiation in our module in Drupal. Here some stuff.
Ideas
- As httpRange-14 says, and according with our URI scheme, we should have something like:
- URI with content negotiation: http://example.com/neologism/bowling#
- HTML without content negotiation: http://example.com/neologism/bowling/html
- RDF without content negotiation: http://example.com/neologism/bowling/rdfs
PHP Info
Drupal Info
- API
- object reference
- node_view()
- arg
- hook_menu()
- path.inc
- path module
- pathauto, a new module to generate path aliases
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);