Hopefully this is a straightforward question.

I'm procedurally building nodes as I walk an XML feed, and am importing them into a production server. I'm having issues importing node aliases, so I thought I could simply create links to the nodes as they will be on production (pathauto will take care of auto-aliasing them).

When I fill the href attribute of my link, instead of pointing to my website it points to my local server (it seems to be auto-changing my link).

I'm building my link like this:

$link = 'http://example.com/content/' . $current_node['name'];
$name = $current_node['name'];

and then assigning in my string

$output = "<a href='" . $link . "'>" . $name . "</a>":

However, as I mentioned, it ends up pointing local instead of direct to my outside node.


If you're creating links, use l().

$url = 'http://example.com/content/' . $current_node['name'];
$output = l($current_node['name'], $url, array('external' => TRUE));
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.