I've a custom module I'm sending the content of node and views by email. The module first render the node/view and wrap the results around common template.
But when my views and node content are build, they contain links are relatives. I'm looking for a way to force these links to be absolute (ie. with domain and protocol).
The url() and l() functions can be used to output absolute links, but I don't see a way to force this behavior on all links. I'm planning to process the content as an HTML string to extract all links and complete the URL when required. But this doesn't seem very efficient.
Is there another way to ensure absolute URL ?
Here is the code used to render the content for nodes and views:
//For nodes
$node = node_build_content($node, FALSE, FALSE);
$node->body = drupal_render($node->content);
unset($node->teaser);
node_invoke_nodeapi($node, 'alter', FALSE, FALSE);
$content = $node->body;
//For views
$content = $view->preview($display_id, $arguments);