I try my hardest that my web page content (specifically links) remain domain independent and would very much like that node content be independent as well but I'm facing a problem with a internal link. Normally I'd simply use <a href="#anchor_or_id_name"> but the node is promoted on the front page and as the destination isn't in the preview, clicking it will do nothing but confuse the user.

So I have to specify the node in the internal link and I'm currently using <?php $path = 'node/20'; $alias = drupal_get_path_alias($path); echo $alias; ?> to achieve this but it brings the problem that I can't know the path during the node creation, so I have to edit it after, and if later I want to include part of the node in another, it will lead back to the original node even if I want to lead to the new node. You may see the result of the code in my homepage DynV avatar which you may see that the internal link function from the outside on the front page.

Is there a code that I may use so that I wouldn't have to specify the node number or a permanent reference in it's content so that clicking on the internal link from outside would lead to the same place as if I'd click from the node itself ? It would be great if the code that would be domain independent (ie: <a href="/path">).

Thanks for your help
DynV

Comments

mtsanford’s picture

I think not. The PHP you are using is a text filter, which when run knows nothing about the node it's in, if it's even in a node (it could just as well be a comment or something else).

You could probably do it, if you really, really wanted to, using a custom designed filter, see http://drupal.org/node/259819

But probably best to just avoid these kind of links, or correct them by hand as you've done.