My problem is similar to http://drupal.org/node/421528

I am running Drupal 6.14 (the Pressflow version) with a multi-site installation. Weblinks is in the common module area.

I have PathAuto set up as suggested in the above issue: links/[vocab-raw]/[catpath-raw] for Taxonomy term path settings. PathAuto is set to have link/[title-raw] for Node path settings.

When I am at example.com/weblinks, the link title has a URL of example.com/weblinks/goto/26 and clicking on it takes me to the link. (I have WebLinks set up to link the title to the site.) Everything seems to work fine on the weblinks page.

When I click on a category for that link, e.g., Devices, I go to example.com/links/web-links/methods/devices. The link title then has a URL of example.com/links/web-links/methods/weblinks/goto/26 and clicking it gives me a 404 error.

Somehow, PathAuto/term info is being added to the title's link path when I am viewing a single category of links. And, yes, I am clearing the cache.

I must have my configuration screwed up somewhere. Anyone have any hints?

Comments

nancydru’s picture

Well, the good news is that you don't have your configuration screwed up. I can reproduce this problem.

The bad news: I haven't a clue as to why this is happening. The HTML is built correctly. In actuality there should be no path alias when you are using click tracking (although I would like to fix that).

I have tried this with three different themes (including Garland and Bluemarine) so it is not a theme issue.

nancydru’s picture

I have also disabled both the core Path module and the Pathauto module and deleted all aliases to a node and this still occurs.

Tally’s picture

Thanks for the hint. I turned off click tracking and the links work. That was one option I did not think to turn off.

I am using Taxonomy Block to display the web link category pages and that is what really brought this to my attention.

Good luck finding the bug. I wish I could help with the code, but I am still struggling with understanding Drupal code. I'll be ready to test the patch, though. I am real good at breaking things. :)

nancydru’s picture

I don't use TB, so that's not the cause. I'm guessing this is a core bug, but can't be sure.

Tally’s picture

The problem is running PathAuto with Weblinks. If I don't use PathAuto, no problem. But, I want to use PathAuto. See http://drupal.org/node/278368 The patch there was just incorporated in the latest release of PathAuto.

To get the terms links working after the update, I used the following settings in PathAuto:

[termpath-raw]/[title-raw] for Web links Node path settings
[cat-raw] for Web links Taxonomy term path settings.

I had to use the above settings because for multilevel categories, the parent term is repeated in the path that appears on the category/group page.

nancydru’s picture

I also use PA. My real life situation is going to put me out of commission for at least several days if not forever.

Starminder’s picture

subscribe

tetramentis’s picture

Category: support » bug

@Tally: thank you for the workaround idea.

Actually, I got it working with these settings:

Default path pattern for Web Links (applies to all Web Links node types with blank patterns below): [termpath-raw]/[title-raw]
Pattern for all Web Links paths: [catpath-raw]

I have found that putting _any_ static string into "Pattern for all Web Links paths" causes that string to be prepended to link URLs, while on any weblinks group pages. When there is no static text there - everything works fine.

Turning off click tracking had no effect (my weblinks node titles lead to nodes, not target URLs).

dgarlock’s picture

subscribing,

no joy after trying the fixes per Tally and tetramentis...

Manu13’s picture

subscribe

Manu13’s picture

whith upgrade core 6.15 --> 6.16, it's give :

my taxinomy is :
weblinks / Hôtels / hotels 1*

so the catégory url for hotels 1* is :
http://www.example.com/h-tels/h-tels-1
the page is ok

when i want to click on a url from a link, it's give :
http://www.example.com/h-tels/content/exemple ::>
it's give a 404 error

help!!!

dgarlock’s picture

Priority: Normal » Critical

I too continue to struggle...

when on mysite.com/category/web-links/term,

paths to node links look like this:

mysite.com/category/web-links/content/link_name

with a 404 error

Nancy confirmed the issue six months ago and still no ideas

izmeez’s picture

subscribing

zoia’s picture

subscribe

dgarlock’s picture

After much frustration, it occurred to me that I had resolved this issue once before, on http://drupal.org/node/582280
In summary, the only thing that worked was reverting back to Weblinks 6.21 http://drupal.org/node/528634

This worked once again, after attempting everything with 6.22, 6.23 and 6.2x-dev.

I like some of the new features in the latest release(s), but 6.21 is working fully and properly for me and I have to move on.

If time permitted, I would compare files in 6.21 with the newer distros.

Nancy, I'd be happy to work with you in any way, even providing admin access to my site (where your excellent Sitedoc module is running) if you're interested.

zoia’s picture

I also reverted to 2.1 and node link works again. Hope this will be solved in next release. One other feature that could be usefull is a back to the links page.Since now when i am to the node i can only see a link to the term of the category that this link belongs to.

nabuzant’s picture

FIX:

Go to line 358:55 of weblinks.module and add /

make it look like this >> $variables['node_url'] = drupal_get_path_alias('/node/'. $variables['nid']);

Sorry, I'm new here so I don't know what the procedures are yet but I hope someone else can take it from here.

Torenn’s picture

As temporary work around you can fix the issue by commenting out line 358 of weblinks.module, I didn't test throughly the side effects but seems to fix the issue efficently (although If I looked at the code well enough it shouldn't cause any side effect...).

nabuzant’s picture

read the comment above you!

Torenn’s picture

Nabuzant,
I'm more then capable to read... although... I'm sorry but your modification is not correct and breaks the node path aliasing capability of the module :-).
Cheers.

boftx’s picture

Here is how I fixed it after nearly going nuts trying to find somewhere to make the change. I don't understand entirely were arg(1) is coming from, but this corrects the problem for my site. The commented out lines are for debugging messages.

$ diff weblinks.module SAVE/weblinks.module
359,363d358
<       if ( is_numeric(arg(1)) ) {
<         $variables['node_url'] = substr($variables['node_url'],9);
<       }
< // JGB
< // print 'from alias ' . var_dump($variables['node_url']) . "<br />\n";
367,368d361
< // JGB
< // print 'from title_link ' . var_dump($variables['node_url']) . "<br />\n";
nancydru’s picture

When you do a diff, please use -up to make a readable patch.

Arg(1) is the second part of the incoming url. http://api.drupal.org/api/drupal/includes--path.inc/function/arg/6

boftx’s picture

Okay, I just wanted to get something out there so you or another developer could get an idea of were I was making a change. For the life of me I couldn't figure out why having arg(1) present would make a difference, but it does. Hopefully this gives you something to work with. I'm not a php programmer, I work with perl and get pretty much down and dirty when doing quick debugs.

nancydru’s picture

Priority: Critical » Major

Yeah, I'm wondering why I used that too, instead of passing it from the menu. "Diff -up" would include some surrounding code that I might get an idea from. I am till recovering from a disk crash and haven't reloaded WL yet.

boftx’s picture

Here is a diff -up for you:

--- SAVE/weblinks.module        2010-12-19 16:31:24.000000000 -0700
+++ weblinks.module     2011-03-03 20:24:09.000000000 -0700
@@ -356,9 +356,16 @@ function weblinks_preprocess_node(&$vari
     // Set the node title destination (1 = node, 0 = site).
     if (variable_get('weblinks_title_link', TRUE)) {
       $variables['node_url'] = drupal_get_path_alias('node/'. $variables['nid']);
+      if ( is_numeric(arg(1)) ) {
+        $variables['node_url'] = substr($variables['node_url'],9);
+      }
+// JGB
+// print 'from alias ' . var_dump($variables['node_url']) . "<br />\n";
     }
     else {
       $variables['node_url'] = $variables['weblinks_title_link'];
+// JGB
+// print 'from title_link ' . var_dump($variables['node_url']) . "<br />\n";
     }
   }
 }

All I did was add a second test that removed the leading "weblinks" from the source URL had a numeric arg(1). The pattern I noticed was that if the links page was being displayed on a URL that had the term id as a number, i.e. "weblinks/18", then the title link was foobared. But if it was on a URL with the term name as the path, i.e. "weblinks/general" then everything was fine. For some reason the alias path, i.e. "weblinks/general/some-faq-topic" is prepended with http://example.com/weblinks/ when the URL contains a numberic TID instead of just http://example.com/ as when the taxonomy term component is not numeric.

This seems to be related to how weblinks.module integrates with weblinks_blocks.module, but I could not find the source of the problem.

Thinking about this further, I would suspect it has to do with the path aliases and how url fragments are handled. Like most, I have term alias set up so a path like 'example.com/weblinks/general' would be a legitmate path to a term page. But a path link 'example.com/weblinks/18' would not be recognized and would therefore have a fragment component of "18" that is passed along in arg(1). This behaviour could affect how the current page URL is calculated somewhere, possibly in the core or path modules as you speculated upon earlier, Nancy.

leahmd’s picture

I had this issue and did a compare of the .module files between my current version and 2.1 where this error was reportedly not a problem. The function hook_preprocess_node() did not exist in the other version so I commented it out and now the title links are working fine for me.

summit’s picture

Hi, Will a solution for this be committed please?

For me the fix was the following.

1) Going back to version 2.1
2) change $title to $node_url in my node-weblinks.tpl.php.

Would love a newer solution to be able to use newer functionality, but this did it for me.
Thanks a lot in advance, greetings, Martijn

hvalentim’s picture

Unfortunately this problem is still around with v. 6.25.

Me too I removed "function weblinks_preprocess_node" and everything seems to be working fine.

izmeez’s picture

The recent post has brought this issue back to the front. As I looked at it I found that the description of the problem was no longer clear to me. So I took a look and will try to describe the problem. I hope this description is helpful and may help identify what the right solution is.

The problem seems to be related to a weblinks block that has a "more" link.
Clicking on the "more" link takes user to the http://example.com/category/weblinks/{weblink_groupname}
The titles of items then have links in the form http://example.com/category/weblinks/weblink/{title_alias}
And these links give a 404 error.

This is in contrast to going to the weblinks page, expanding a weblink_groupname, and clicking on a title. In this case the link is in the form http://example.com/weblink/{title_alias} and does not give a 404 error.

This behaviour may be resulting from the path alias settings and may require node paths and taxonomy term paths to be set as follows:
Node paths, Pattern for all Web Links path: weblink/[title-raw]
Taxonomy paths, Pattern for all Web Links paths: [catpath-raw]

This may just be a work around and the proper fix something else as suggested in comments #8 or #18 or #26.

izmeez’s picture

In regards to comment #26, the function hook_preprocess_node() was introduced on 2009-09-16 in commit http://drupalcode.org/project/weblinks.git/commit/9eec5a867b7b532cd24d9c... and is related to http://drupal.org/node/579208, "Make fields available to cck". Removing this is probably not the way to go. Unless there is something wrong with the code this may not be the culprit.

This then brings comments #5 and #8 as possible front runners.

GStegemann’s picture

Issue summary: View changes

Please check if the patch of issue #2237875: Group page has badly formed urls to weblink nodes fixes this.

jonathan1055’s picture

Status: Active » Fixed
Related issues: +#2237875: Group page has badly formed urls to weblink nodes

Judging by the comment in #25 I think that #2237875: Group page has badly formed urls to weblink nodes is the correct fix for this problem. Marking this issue fixed now, as the D6 commit was on 16 April 2014 so will be in 6.x-2.6

Please re-open if you still get the original problem. We will hopefully be releasing 6.x-2.6 soon as 2.5 is 2.5 year old (!)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.