Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Jun 2009 at 14:50 UTC
Updated:
19 Jul 2010 at 23:29 UTC
I've got View and I wanted to create 'Link path:' in Field Configuration as follow (Output this field as a link):
node/add/page/%1/[nid]
Where %1 is my argument, and [nid] is nid of current node
This link is converted to some rubish:
node/add/page/%252F223
Any solution?
Probably related topic:
#191394: Views URLs are using "+" instead of my drupal default "-"
Comments
Comment #1
kenorb commentedTemporary solution is to create tpl file:
views-view-field--my_view_name--field-image-fid.tpl.php
with code:
Comment #2
merlinofchaos commentedI'm not 100% sure -- but is http://drupal.org/node/482162 the same problem?
Comment #3
kenorb commentedNot really, I've checked that patch, but in this place after patched line path is still correct:
node/add/parent-newsletter//224
and changed somewhere after to:
node/add/parent-newsletter/%252F224
Comment #4
agentrickard@kenorb
I notice the double-slash in that URL -->
node/add/parent-newsletter//224. Is that deliberate?This looks to me like a case where the argument %1 is empty. This came up when I wrote the original patch. When the argument is empty, we don't know what to put in the URL (though I suspect it is 'all' or some other $option of the argument).
I suspect that Drupal's url() function is munging the //.
Comment #5
kenorb commentedI've tested again, and if I added 'Node: Nid' as argument and selected: 'Exclude the argument' (because then my view is hidden when passed the second argument).
Then I'm going to my view: template_picture/220
And my link now is converted from:
node/add/parent/%1/[nid]
to:
node/add/parent/Template01/223
So instead of expecting the [nid] I've got title of the node (nid = 220)
My available replacement patterns:
Fields
[nid] == Node: Nid
[field_template_image_fid] == Content: Template Image (field_template_image)
Arguments
%1 == Node: Nid
It's not working right, or I don't know how to use it properly;/
Comment #6
agentrickardWell the title rewrite part is by design in the definition of the NID argument handler.
[nid] in the above replacement pattern is the NID of the returned row, which you don't want.
You probably need to make your View load the parent id as a field (set it to not display and load it before this field is used) and use that for the token. Something like:
And leave the argument handler out entirely.
Comment #7
kenorb commentedCurrently I've got this working by defining link:
node/add/parent/[arg1]/[nid]
using [arg1] token which is created in TPL file with following line:
It's quite complicated, but it's working.
So I understand that's not possible to get somehow arg(1) directly using Views?
In summary: Yes, this %252F probably could be because of double slash (because of missing %1).
Comment #8
agentrickardThe Views NID handler automatically translates NID into node title. You would need to override that in the theme layer or a custom argument handler.
See #472194: %1 output as [title] instead of [nid] in fields setting "Output this field as a link" of Views for similar and a proposed solution.
Comment #9
kenorb commentedSomething related #518398: Tokens in Views Replacement Patterns?
Comment #10
esmerel commentedNo activity for 6 months