Gossamer Forum
Home : Products : Links 2.0 : Customization :

Using URL for email and Title as name

(Page 1 of 2)
> >
Quote Reply
Using URL for email and Title as name
This is difficult to explain.
Hundreds of my questions have been answered by searching the forum. Still can't figure how to get 3 columns, and why my links.css file is not picked up on each page, but that's another day.

For now. . .
I am using Links2 as a registry of names who own a particular car. The Title field is used as the person's name. The URL field is a mailto: tag. I commented out what's cool, top rated, random search, hits among other things that are not necessary. If someone as the time, my modify page is at
http://www.happytogether.com/...y/cgi-bin/modify.cgi.

Things I don't like.
I must use the mailto: in the field that would normally be the URL. Also, Name and Contact Name is redundant as well as he 2nd and 3rd email address. Ideally I would like to remove the 2nd Name field and 3rd email field.

Briefly, my links.def file is
# Database Definition: LINKS
# --------------------------------------------------------
# Definition of your database file.
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Title => [1, 'alpha', 40, 75, 1, '', ''],
# URL => [2, 'alpha', 40, 75, 1, 'http://', '^http|news|mailto|ftp'],
# URL => [2, 'alpha', 40, 75, 1, 'mailto:', '^http|news|mailto|ftp'],
URL => [2, 'alpha', 40, 75, 1, '', '.+@.+\..+'],
Date => [3, 'date', 15, 15, 1, \&get_date, ''],
Category => [4, 'alpha', 0, 150, 1, '', ''],
Description => [5, 'alpha', '40x3', 500, 0, '', ''],
'Contact Name' => [6, 'alpha', 40, 75, 1, '', ''],
'Contact Email' => [7, 'alpha', 40, 75, 1, '', '.+@.+\..+'],
Hits => [8, 'numer', 10, 10, 1, '0', '\d+'],
isNew => [9, 'alpha', 0, 5, 0, 'No', ''],
isPopular => [10, 'alpha', 0, 5, 0, 'No', ''],
Rating => [11, 'numer', 10, 10, 1, 0, '^[\d\.]+$'],
Votes => [12, 'numer', 10, 10, 1, 0, '^\d+$'],
ReceiveMail => [13, 'alpha', 10, 10, 1, 'Yes', 'No|Yes']
);

and my add.html file is
<form action="<%db_cgi_url%>/add.cgi" method="POST">
<p>Please fill out the form completely, and we'll add your name as soon as possible.</p>
<div class="margin">
<table border ="0" cellspacing="0" cellpadding="0">
<tr><td align="right" valign="top">Name:</td>
<td><input name="Title" size="50"></td></tr>

<!-- <tr><td align="right" valign="top">URL:</td> -->
<!-- <td><input name="URL" size="50"></td></tr> -->

<tr><td align="right" valign="top">Email Address:</td>
<td><INPUT TYPE=text NAME=URL VALUE="mailto:" SIZE=50 maxlength=125></td></tr>

<tr><td align="right" valign="top">Location:</td>
<td><%Category%></td></tr>
<tr><td align="right" valign="top">Description:</td>
<td><textarea wrap="virtual" name="Description" value="" rows="3" cols="42"></textarea></td></tr>
<tr><td align="right" valign="top">Contact Name:</td>
<td><input name="Contact Name" value="" size="40"></td></tr>
<tr><td align="right" valign="top">Contact Email:</td>
<td><input name="Contact Email" value="" size="40"></td></tr>
<tr><td></td><td><input type="SUBMIT" value="Add Resource"></td></tr>
</table>
</div>
</form>

I hope someone understands what I am trying to do.
...steven
MINI Links
BMW 318ti Registry

Last edited by:

steven1214: Jan 3, 2003, 7:23 PM
Quote Reply
Re: [steven1214] Using URL for email and Title as name In reply to
Links was designed to allow a yahoo-like directory. that you are able to adapt it for a somewhat different purpose is a testment to the original design. While I realize you are not complaining, there are going to be some things that you you will just need to live with.

I am not sure that I see your "3rd email." The contact name and email are fairly integral to Links and not easily deleted from links.def. As a suggestion, you could make the contact email a "private" email to be used to contact the owner and the "URL" email a "public" email. Of course the owner could elect to have them the same. You could so something similar with the Title/Contact Name.


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Quote Reply
Re: [esm] Using URL for email and Title as name In reply to
By far I'm not complaining. If I can't make Link2 do anything more, I'd be happy at this point. Unfortunately I do not have an understanding of Perl. I know there will be limitations, I just don't know what those limitations are. So until someone says it can't be done, I will have to ask questions.

To make it a little clearer, my modify.html page is

Please enter the information you wish to update. Make sure your email address is identical as in the database.

Email Address:[mailto:___________] (which in reality is 'Current URL')
Now enter the new information (all of it, not just the changes) below.

Name: [__________________] (which is 'Title')
Email Address:[__________________] (the 'URL']
Location: [__________________] ('Category')
Description: [__________________]
Contact Name: [__________________]
Contact Email:[__________________]

The 2nd Email Address and Contact Email should actually be the same address. The first email address can be the one originally used. The Name and Contact Name are the same also.
If I could automatically have the email address pop in the additional field, that would be fine. Or if I can add something in the script like set 'Contact Name' to 'Title' and set 'Contact Email' to 'URL'. It does not even need to be visible.
...steven
MINI Links
BMW 318ti Registry
Quote Reply
Re: [steven1214] Using URL for email and Title as name In reply to
In the links.def, where you have this:

'Contact Name' => [6, 'alpha', 40, 75, 1, '', ''],

the red '1' is making it a required field. Setting it to '0' will make it not required, so that field can be left empty. I have a site that does not use Contact Name or Contact E-mail; the only standard fields in use are ID, Title, URL, Category, Description, and Date.

The program is VERY flexible, you just have to figure what changes to make. Any you're right, most of the answers are here, already. Now where was that post...?

Anyway, you can go ahead and use the Contact E-mail for your first line, and avoid the redundancy. Also, you can create the specific fields you need, and name them what you want (Location...). Search for "Adding Fields for Dummies" for an excellent how-to.

---------

After visiting your site: if you're going to have fields that will always have a few certain entires (model, year), you could present that in a drop-down select list.


Leonard
aka PerlFlunkie

Last edited by:

PerlFlunkie: Jan 4, 2003, 12:43 AM
Quote Reply
Re: [steven1214] Using URL for email and Title as name In reply to
when I look at your modify page ( a little more closely this time ), I see your "third" email. You have two lines with label prompts of Email Address: If I look at the html of the first one I see

Code:
Email Address:<INPUT NAME="Current URL" Value="mailto:" SIZE=50
maxlength=125>(include mailto: in this field only)


I'm not sure what this does, if anything. The name "Current URL" is not a part of links.def and thus not stored in the links.db file. Unless it is used somewhere in the modify.cgi ( maybe as part of a password mod ), then removing this html code would have not have any effect.

You can populate the fields in the the modify.html by using the Value tag

Code:
change
<tr><td align="right" valign="top">Email Address:</td><td>
<INPUT TYPE=text NAME=URL VALUE="" SIZE=50 maxlength=125></td></tr>
to
<tr><td align="right" valign="top">Email Address:</td><td>
<INPUT TYPE=text NAME=URL VALUE="<%URL%>" SIZE=50 maxlength=125></td></tr>

the description is a little different
<TEXTAREA NAME=Description ROWS=3 COLS=42 WRAP=virtual value="" ><%Description%></TEXTAREA>


It's a little hard to do this with the Category tag. You can hack the select build subroutine or just print out what the current category is ( so they will know what is is ) and let the owner re-select it.

Doing the above would help the link owner know what the current info is.

you can create fields for city - year - model - color ( do a search for adding fields )

Code:
City => [14, 'alpha', 40, 75, 1, '', ''],etc, etc





As the PerlFlunkie suggests you can make some fields non-required fields. While I thought of suggesting this originally given your initial comments of not needing them, I would not do it because you would effectively eliminate a significant feature of the Links program. Or at least make it difficult to use. Specifically, you would not be able to use the Email the link owner feature. Well, not unless you learned enough perl to assign the Title/URL variables to the Contact Name/Contact Email variables when running that feature. Or have someone with perl knowledge do it for you.

But maybe you don't need that feature. If so, make it non-required and remove it from your add.html and modify.html pages. Just make sure you will NEVER need it. Retrieving uncaptured data is almost as difficult as taking your description and separating it into separate fields of city, year, model and color. Not impossible, since you have captured the data. Just difficult.

Since I don't know a lot of perl, I learned the hard way not to eliminate features in Links. I may never use them but they are still there. But that's just me.

ya' pays ya' money and ya' takes ya' chances.


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Quote Reply
Re: [esm] Using URL for email and Title as name In reply to
Current URL is used by Links2 when modifying a link to look up the record.
Quote Reply
Re: [esm] Using URL for email and Title as name In reply to
Hmmm?
I can 'not require' 'Contact Name' since that is completely redundant in my case. I know who is the contact by looking at the Title field. But I do need 'Contact Email' since that is what is used to email users. What I can do instead of saying 'Contact Email' on the webpage, just say, Verify email. It would do nothing other than give the illusion that the user is not typing in their email address twice for nothing. Now if there was a routined that would actually verify that the person entered their email address the same twice, that might be better.

Since I just woke up I need to reread everyone's posts.
Thanks!Smile
...steven
MINI Links
BMW 318ti Registry
Quote Reply
Re: [Paul] Using URL for email and Title as name In reply to
yep, I never used the original modify.cgi. Installed a password mod and I switched to yours and they don't use the current url. it is required in the original modify.cgi


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."

Last edited by:

esm: Jan 4, 2003, 6:09 AM
Quote Reply
Re: [steven1214] Using URL for email and Title as name In reply to
Or, you could just have the Contact E-mail be a hidden field (not actually appear on the page), and use your first field to fill it by using value="<%URL%>" or whatever...


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Using URL for email and Title as name In reply to
I'm taking one step at a time.

In links.def I changed the Contact Name to be
Code:
'Contact Name' => [6, 'alpha', 40, 75, 0, '', ''], #not required

I have commented out all mention of Contact Name.
After entering my information on the modify page I get an error saying,
Unkown Tag: Contact Name

The only documents I see Unkown used is nph-build.cgi and rate.cgi. Even though I get the error message. The data is written in to be validated.
...steven
MINI Links
BMW 318ti Registry

Last edited by:

steven1214: Jan 4, 2003, 4:18 PM
Quote Reply
Re: [steven1214] Using URL for email and Title as name In reply to
The Unknown Tag error means it does not know (where to look to define) what Contact Email means. You will need to remove that field from the links.db, also; you would need to remove the entry (joe @ smith dot com) and the pipe | next to it (just one!). It might be easier (and less disruptive) to make a clone of your links, but put it in a new directory named /test/ or something. Then, reduce the category.db and links.db in that test Links to a dozen listings or so, which will make testing easier. Then, once it's all working the way you want, copy your changes over and edit the links.db as required.


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Using URL for email and Title as name In reply to
It's actually Contact Name that is giving me the problem.
What I will do is edit my links.db to remove 'Contact Name|' all together. Then I imagine I should remove the Contact Name line from links.def all together since links.db will no longer have 14 fields. I think I should then renumber the fields in links.db, 0-12.

Thanks again!
...steven
MINI Links
BMW 318ti Registry
Quote Reply
Re: [steven1214] Using URL for email and Title as name In reply to
open your editor and search the following files using the keyword contact

add.cgi, modify.cgi, admin_html.pl, db.pl, nph-mail.cgi, site_html.pl

do the same for add.html, add_error.html, add_success.html, email-add.txt, email-mod.txt, modify.html, modify_error.html, modify_success.html.

for each, search the entire document noting the places where Contact Email ( and Contact Name, for that matter ). Notice which subroutines are used.

If you are not going to use Contact Email, just make it non-required and delete it from your html pages. Then just don't use those features.

You cannot just comment out a line or two. You really need to understand what the line does.


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Quote Reply
Re: [steven1214] Using URL for email and Title as name In reply to
You really ought to use DBMAN for this application. The internal workings of Links was designed for a search engine for web sites and thus the database structure is tied extensively to the scripts. Removing fields can cause more harm than good if not done right.

A templates mod and I believe a static pages mod have been released for DBMAN so it more closely mimics Links.

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [fuzzy thoughts] Using URL for email and Title as name In reply to
I looked at DBMan. From the little tour I took I did not think it would do what I want. I really like the way Links2 looks.

I tried writing out all the references to Contact Name.
I rewrote my links.db file to omit Contact Name. I have tried both suggestions to no avail.

Even with keeping the redundant fields, Link2 will work fine.
It's better than people sending me a message and me hard coding a html page.

I think a better way will be if I can have one field write to another. But for now, I'm still very happy with what it's going to do for me.

And the support I've received has been fantastic.
So good that I wanted to install Forum software. Until I downloaded MYSQL. Yikes! That's way to much over my head.
...steven
MINI Links
BMW 318ti Registry
Quote Reply
Re: [steven1214] Using URL for email and Title as name In reply to
Actually, you could not use the URL field at all, if all you want are e-mail links. Also remove the Title field. To make the listing like you have it now, with the owner's name first, and linked to e-mail, maybe try:

<a class="link" href="mailto: <%contact_email%>"><%contact_name%></a>

This would go in link.html, to replace this line:

<a class="link" href="<%db_cgi_url%>/jump.cgi?ID=<%ID%>"><%Title%></a>

This would stop the new, blank page from opening, and just pop up the viewer's email client. It will also greatly simplify you add/modify forms.

From this:

Name
Email Address
Location
Description
Contact Name
Contact Email

to this:

Name
Email Address
Location
Description

You can of course rename the caption for each field on the form (add.htm/modify.html), without affecting the form action (from 'Contact Name' to 'Name'.) Remenber to make the same changes to the error pages.


Leonard
aka PerlFlunkie

Last edited by:

PerlFlunkie: Jan 5, 2003, 12:43 PM
Quote Reply
Re: [steven1214] Using URL for email and Title as name In reply to
In Reply To:
why my links.css file is not picked up on each page, but that's another day.

I have not read all the above posts, so unsure if one of your points has been solved. But its quite simply, on each template make sure you have
Code:
<link rel=stylesheet href=<%css%> type=text/css title="style sheet">
in your <head> tags.

Stu2000

- Top 100 forums / GT Links 2.0 websites -
Quote Reply
Re: [PerlFlunkie] Using URL for email and Title as name In reply to
Getting closer.Smile
I replaced the first line on my links.html page with
Code:
<a class="link" href="mailto:<%contact_email%>"><%contact_name%></a>
Now when I modify I don't get that error message. Much cleaner. But I still need to have all the fields filled out.

Is this where I go back to links.def and make Title and URL not required?
...steven
MINI Links
BMW 318ti Registry
Quote Reply
Re: [steven1214] Using URL for email and Title as name In reply to
I went ahead and set URL and Title to unrequired.
Removed URL and Title from my add and modify html pages.

modify.html works beautifully!
add.html still gives me an error message.
Unkown Tag:Title
...steven
MINI Links
BMW 318ti Registry
Quote Reply
Re: [steven1214] Using URL for email and Title as name In reply to
Glad to hear you're gettin' there! Unknown tag means the <%tag%> is being called, but is not defined for that page. Try adding this to the sub site_html_add_form (and error) in site_html_templates:

title => $title,

But after looking at your add page, and its source code, I think the problem is in a missing bit of code at the top of the page:

<title>: Add a Name</title>

which should look like this in your template:

<title><%site_title%> : Add a Name</title>

You may have changed <%site_title%> to <%title%>


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Using URL for email and Title as name In reply to
Tried that, didn't work.
I searched for what files has %title% in them.

modify_success.html
add_success.html
email-mod.txt
email-add.txt

I removed %title% and %url% from those files.

Now my add and modify work, but have created a new problem.
For the links it now shows Unkown Tag:contact_email Unkown Tag:contact_email Unkown Tag:contact_email Unkown Tag:contact_email on every page.

I thought this was going to get weird because the search wasn't working either.

My links index page is now http://www.happytogether.com/.../registry/index.html

My links.def is now
Code:
# Database Definition: LINKS'Contact Name' => [6, 'alpha', 40, 75, 1, '', ''],
# --------------------------------------------------------
# Definition of your database file.
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Title => [1, 'alpha', 40, 75, 0, '', ''], # not required
# URL => [2, 'alpha', 40, 75, 1, 'http://', '^http|news|mailto|ftp'],
URL => [2, 'alpha', 40, 75, 0, '', '.+@.+\..+'], # not required
Date => [3, 'date', 15, 15, 1, \&get_date, ''],
Category => [4, 'alpha', 0, 150, 1, '', ''],
Description => [5, 'alpha', '40x3', 500, 1, '', ''], # required
'Contact Name' => [6, 'alpha', 40, 75, 1, '', ''],
'Contact Email' => [7, 'alpha', 40, 75, 1, '', '.+@.+\..+'],
Hits => [8, 'numer', 10, 10, 1, '0', '\d+'],
isNew => [9, 'alpha', 0, 5, 0, 'No', ''],
isPopular => [10, 'alpha', 0, 5, 0, 'No', ''],
Rating => [11, 'numer', 10, 10, 1, 0, '^[\d\.]+$'],
Votes => [12, 'numer', 10, 10, 1, 0, '^\d+$'],
ReceiveMail => [13, 'alpha', 10, 10, 1, 'Yes', 'No|Yes']
);

link.html
Code:
<ul><li><a class="link" href="mailto: <%contact_email%>"><%contact_name%></a>

I'll tackle this another day.
...steven
MINI Links
BMW 318ti Registry
Quote Reply
Re: [steven1214] Using URL for email and Title as name In reply to
if you want to print out something in the links.db file ( date, category contact name, contact email ), you must use the definintion in links.def in the html page.

contact name is <%Contact Name%>
contact email is <%Contact Email%>

<ul><li><a class="link" href="mailto: <%Contact Email%>"><%Contact Name%></a>

contact_email is not in the links.def file


sure seems like a lot effort to delete two pipes "|" from the links.db file. just make contact email and name non-required and leave 'em blank. Don't even put them on the html pages. then use perl or javascript to populate them from the title and url fields if you ever need them.


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Quote Reply
Re: [esm] Using URL for email and Title as name In reply to
Instead of using title and url for my links, I want to use contact name and contact email. Instead of http: I used mailto:

It will work if I have people use their name as title and their email address as url, but then it's redundant since it's also there for the contact name and email.

I don't understand why you say contact email is not in the links.def file.

Code:
'Contact Name' => [6, 'alpha', 40, 7 5, 1, '', ''],
'Contact Email' => [7, 'alpha', 40, 75, 1, '', '.+@.+\..+'],

Oh wait a second. I lost the come for field 6 between 7 and 5. I'll have to fix that and see what happens.

Oh nevermind, that was supposed to be 75. Besides, fixing that did not help.Frown
...steven
MINI Links
BMW 318ti Registry

Last edited by:

steven1214: Jan 9, 2003, 9:04 PM
Quote Reply
Re: [steven1214] Using URL for email and Title as name In reply to
Sorry I steered you a bit off, what esm wrote is correct:

<%contact_name%> should be <%Contact Name%>

<%contact_email%> should be <%Contact Email%>


Leonard
aka PerlFlunkie
Quote Reply
Re: [steven1214] Using URL for email and Title as name In reply to
well,I confess that I am confused Crazy. I don't know whether you want to use Contact Email/Name or not. Blush

I thought you felt those fields were duplicates - not needed/redundant. I thought that was the purpose of this thread to remove some of these unneeded fields/code from Links.

so I'm going to bow out of this one before I show how truly igorant I really am.......!!! Sly


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
> >