By cybertron1 on
Well, as my title says, is it possible to change the way that links behave in Drupal?
I have some external webpages that must use a relative path such as http://example.com/testlink/test.htm instead of http://example.com/index.php?q=testlink/test.htm
i have been trying to change this in my template.php with the following code. It seems that the "path" is correct (tried with printing it) althought I believe that the $link_item might have something to do with the problem.
When I create my link in the menu module I use /testlink/test.htm and then it changes my link to an internal node (which I DONT want)
All ideas is accepted!!
function dg2k_menu_item_link($item, $link_item) {
if ((substr($link_item['path'], 0, 4) == 'http')) {
return l($item['title'], $link_item['path'], isset($item['description']) ? array('title' => $item['description'], 'target' => '_blank') : array('target' => '_blank'));
}
if ((substr($link_item['path'], 0, 1) == '/')) {
return l($item['title'], $link_item['path'], isset($item['description']) ? array('title' => $item['description'], 'target' => '_blank') : array('target' => '_blank'));
}
else {
return l($item['title'], $link_item['path'], isset($item['description']) ? array('title' => $item['description']) : array());
}
}
Comments
I have solved it!! I did it
I have solved it!!
I did it like this:
this doesn't work with drupal 6....
Hi!
Now it has come to the fact that I need to upgrade my systems to drupal 6.x
and the above function doesn't work any more. Does anyone know how to correct that?
thanks in advance.
i have come this far:
Solved it again....