Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Input field info from another field

Quote Reply
Input field info from another field
Hi All,

In my directory, the url is displayed as text in the links.html file. however. some customers like to have a different link for tracking. IE.

their url is www.myurl.com but they would like the link to www.myurl.com/tracking.cgi

Obviously i dont want to display the long url only the normal one, I know that setting up another field is easy and how to display it using if commands in the links.html template. however. is there a way in which i can get the second field to be automatically filed in with the contents of the original url, to save time having to enter it twice!!! then change it if need be.

I'm sure this could be done with a little javascript, but im not javascript savvy,, Help anyone!!



Regards

MDJ1
http://www.isee-multimedia.co.uk
Quote Reply
Re: Input field info from another field In reply to
I suggest that you add a couple of fields to your Links database. One containing the alternative URL and they other to tell whether its used. You can then modify your templates accordingly.

I used this method to add a graphic to sites that are UK based. See the Priority Logo Links and Regular Logo Links MOD for instruction on how to make modifications to you database etc. (http://www.gossamer-threads.com/...rces/jump.cgi?ID=134).

You won't need to do everything in the MOD, just add something like this to links.def:

AltURL => [14, 'alpha', 40, 75, 0, '', ''],
IsAlt => [15, 'alpha', 0, 5, 1, 'No', 'No|Yes']

Then, in you links.html file add something like this:

<%if IsAlt%>
<a href="<%db_cgi_url%>/jump.cgi?ID=<%ID%>" target="_blank"><%AltURL%></a>

<%endif%>

You'll have to work out the other bits in between; see the link above. No guarantees that it'll work, you'll just have to try it out.

Martin Webster
--
Cebidae's UK Internet Resource
http://www.cebidae.co.uk/
Quote Reply
Re: Input field info from another field In reply to
Mmm. I've been looking at this and have added the new fields to the database etc. The only problem i can see is that the links program is still going to try and connect to the jump.cgi with the ID number and the original URL. how can i change the software to say use the AltURL if displayed?

Regards

MDJ1
http://www.isee-multimedia.co.uk
Quote Reply
Re: Input field info from another field In reply to
Right OK!.

What i have done is placed the tracking URL in the <%URL%> box and the normal url in the <%AltURL%> then i have added the following code to the liks.html template.

Code:
face="Geneva, Arial, Helvetica, sans-serif" size="2"><small><small> <%endif%>
<%if isalt%><%AltURL%><%endif%><%ifnot isalt%><%URL%><%endif%>
but for some reason it is displaying both urls. Anyone know why??


Regards

MDJ1
http://www.isee-multimedia.co.uk
Quote Reply
Re: Input field info from another field In reply to
Remember that tags are case sensitive...you should be using the following:

Code:

<%if IsAlt%>
<%AltURL%>
<%endif%>
<%ifnot IsAlt%>
<%URL%>
<%endif%>


Also, make sure that you have the following codes in your sub site_html_link routine in the site_html_templates.pl file:

Code:

($rec{'IsAlt'} eq 'Yes') ? ($rec{'IsAlt'} = 1) : (delete $rec{'IsAlt'});


Didn't you already write a similar mod "IsLinked"???? This is the EXACT same logic! Wink

Regards,

Eliot
Quote Reply
Re: Input field info from another field In reply to
Hi Eliot,

Mmm I added them case correct. in my links.def isalt is in lower case. should the first be a capse?

I also added the code to sub site_html_link after i posted.

I did manage to get it working after absolutely ages. I am still having a small problem though. I had a default value of http:// in the AltURL field and no matter what i placed in the link.html template it always showed this unless the isalt was set to yes.

So it worked perfectly when set to yes, but when set to no it added http:// Strange!!!

Anyway, I opened up the database and removed the http:// from 3000 links. used Arachnophilia for this. Excellent Careware program..


Regards

MDJ1
http://www.isee-multimedia.co.uk