CCK link should take token as part of URL

SocialNicheGuru - March 24, 2009 - 17:48
Project:Link
Version:6.x-2.6
Component:Code
Category:task
Priority:critical
Assigned:Unassigned
Status:active
Description

I am not sure if this is a bug report or a feature request.

CCK link can take tokens for titles.

Can it also take tokens for urls?

It would be very beneficial if I want to create default urls for users.

Chris

#1

presleyd - March 26, 2009 - 15:48

Hmmm I was just wondering about this myself, I was sure an older version used to do this.

#2

SocialNicheGuru - April 21, 2009 - 14:42
Priority:normal» critical

#3

jcfiala - April 21, 2009 - 15:56
Category:bug report» task
Priority:critical» normal
Status:active» postponed (maintainer needs more info)

Well, at the moment it sounds like new functionality. At the moment I'm concentrating on getting 6.x-2.6 out the door (see the shiny beta release? Please test!) but I'm welcome to hearing more about what you're interested in this doing. I haven't used the token functionality that is in link yet, so I'm not sure how that works in titles yet.

#4

szegedi - April 22, 2009 - 07:54

Hello, I try to solve a similar problem, but that would be the best way, if token can be added to url, because I try to find way to add variables (ex: node id) to link url dinamically, but the only way is php code... a module, or a patch to link module would be better...
Thnx
Szg

#5

SocialNicheGuru - April 22, 2009 - 12:31

From what I read, tokens in titles are fine.

But I would like to have tokens accessible for the url.

For example, I would like to setup a cck link, my profile. the cck field would be user/[author-id] and when the link is used, the proper replacement for [author-id] would happen.

Simple use case, but I think it gets the point accross

#6

minus - April 29, 2009 - 06:39

I am also very interested in a function like this

I'm working on a project where I need a field with a default url. The client fills out the form, a combination of the default url and what the user submits should be the final url.

Default setting for the link field should be something like this: http://www.link.com/#, when the user submits his form, the field should be http://www.link.com/#*****, and displayed on the node like "go to website". I have tried to solve this with link 6.x-2.5 ut with no luck.

Really need this function and hope you can help me :)

Morten

#7

minus - April 30, 2009 - 15:31

am I just stupid or can this be done differently? :D

#8

jcfiala - April 30, 2009 - 16:21
Status:postponed (maintainer needs more info)» active

I don't know what you mean, and I know I don't know you well enough to tell if you're stupid. :)

That said, there's usually more than one way to do something, especially if you're willing to roll up your sleaves and do some custom coding. using hook_nodeapi and an appropriate hook, you could change the value of the url when it's being displayed on a given context. Similarly, you could try doing something like that in the theme layer, overriding the node template involved.

Although I think the idea of having a token-replace in a url is a neat one, it's not currently a prioritiy to me - getting the module released at 6.x-2.6 is top priority for me, and then I want to fix up my DME module for an official 6.x release.

Of course, if someone wants to submit a patch...

#9

minus - May 1, 2009 - 09:11

:D

I just want a field in my form where the user submits a number, when the user submits his form the number he entered will be part of an url that is showed as a link on his node. It's like a combination of a default url and what the user submits. If the default url is http://www.link.com/ it will be http://www.link.com/123 after the user has submitted his form. Possible?

I have no php skills at all :-/

#10

minus - May 2, 2009 - 08:24

I fixed this with views:

content field and select "Output this field as a link", add the url and Replacement pattern: http://example.com/[field_your_field__value]

#11

SocialNicheGuru - May 2, 2009 - 12:11

is [field_your_field_value] a token or a specific field.

My original idea was around tokens in link.

Thanks,
C

#12

minus - May 2, 2009 - 15:05

its a specific field, sry :(

#13

bit7 - June 10, 2009 - 16:20

+1

#14

bit7 - June 16, 2009 - 10:51

@minus: You don't really need an extra content field [field_your_field__value] to add a reference argument to a link. The easiest way is just use the custom cck link field and put your link there manually. For example reviews/209

With token like reviews/[nid] would be nice. So the user don't care about this field and will see only the final link. I hope this feature will implemented soon.

Edit: I see that token already works with this option in link url fields only for the node edit form:
[x] Allow user-entered tokens
Checking will allow users to enter tokens in URLs and Titles on the node edit form. This does not affect the field settings on this page.

Another way to create custom links is to use the "custom links" module :) ->http://drupal.org/project/custom_links

This module supports tokens in URL. So it's very flexible and easy to create automatically links.

#15

minus - June 16, 2009 - 06:43

In my case, the content type is a car-ad, where users can create ad's for their cars and boats. The link field(content-field) is the "number-plate"'s number, when the user fill this out and the node is being viewd, the field is a link to the an official database where users can check the car for financial issues. Id that can be done with custom_links I'm pleased.

#16

SocialNicheGuru - June 16, 2009 - 14:27

I read that I could use custom links module to add a token to the actual URL. But does that module setup a cck so I can theme each link individually? Or does it just add an additional link to $node->link?

Thanks,
Chris

#17

bit7 - June 16, 2009 - 19:13

It adds additional links to "$node->link" for nodetypes. I think you can theme these links individually. Usually they are display after the body content.

#18

tinem - August 22, 2009 - 06:32

Think I have the same problem as mentioned here but can't figure out how to solve it. Hope some one can help with code to use, please?

CCK field as link - why is [nid] not functioning dynamic?

On this post http://www.tinemuller.dk/drupal/node/1139 in the link after New Find it on: http://www.tinemuller.dk/drupal/node/1097/?querynid=[nid] I can't understand why [nid] is NOT functioning - do you?

If you change [nid] to the node 1139 like this http://www.tinemuller.dk/drupal/node/1097/?querynid=1139 it's functioning. Have used days to solve this without success but I'm sure it can be done.

I have made this selections http://www.tinemuller.dk/drupal/div/New_Find_it_on.gif

Do I need to make it with some PHP code and if yes can you suggest the PHP code?

Or do I need to make it selecting some of the possibilities further down on the site where Token is mentioned?

#19

tinem - August 23, 2009 - 06:52
Version:6.x-2.5» 6.x-2.6
Priority:normal» critical

#20

bredi - August 23, 2009 - 19:45

BUMP

I have the same issue/request.

I tried enabling "Allow Tokens" as well. But it doesn't work.

thanks

#21

marcoBauli - August 27, 2009 - 13:47

similarly here "Allow user-entered tokens" does not have any effect.. opened a separated issue at http://drupal.org/node/561084

#22

SocialNicheGuru - September 1, 2009 - 20:42

i am taking a look at the cck link and I see that I can add in a default cck link value. I was going to use php to try and fill in the value

user/uid

but how do I specify uid of node author:

$node->uid

Do i have to perform a node_load? does this work when someone is submitting the node for the first time?

#23

tinem - September 17, 2009 - 17:22

#18

If this will never get to functioning with token [nid] what can be used instead?

 
 

Drupal is a registered trademark of Dries Buytaert.