Gossamer Forum
Home : Products : Links 2.0 : Customization :

Add New Variable / Create a New Page

Quote Reply
Add New Variable / Create a New Page
I want to include a new variable and textarea in the add new link form. From what I discovered, it seems like i have to edit site.pl and site_template.pl as well. Can anyone give me specific instructions on how to declare a variable and have it used through out the program?

Also, i intend on taking some variables and use it to generate a new page (in the manner of message boards, if you will) using some codes from a cgi card program, the url of that page should be automatically entered as the URL of the entry. Are these tasks too much for me, a CGI novice, to undertake? If so, are there better alternatives, such as using the detail page to display the said textarea variable?

Thanks in advance,
Sam

http://boxmansion.homepage.com
Quote Reply
Re: Add New Variable / Create a New Page In reply to
Adding a new field/variable textarea.

First define a Newvariable in links.def replace the original with the following:


# 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'],
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'],
Newvariable => [14, 'alpha', '40x3', 500, 0, '', '']
);



Then use bobsies upgrade.pl to add a new field to links.db.

Then Somewhere in link.html add

<%Newvariable%>

or whatever name you call the field.

Also you'll probably want to add the field in the email/add/delete/modify.txt

Newvariable : <%Newvariable%>


Also you'll need to alter the templates:

in add.html insert:

<TEXTAREA wrap="virtual" name="Newvariable" rows="3" cols="42"></TEXTAREA>


In add_error.html insert:

<TEXTAREA wrap="virtual" name="Newvariable" rows="3" cols="42"><%Newvariable%></TEXTAREA>


Finally in add_success insert:

Newvariable: <%Newvariable%>

Changing Newvariable to whatever you named it to.



I think that should do it! You might need to edit nph_build.cgi and site_html_templates.pl
I'm quite new to perl so although I think it should work.... but it might not!



Glenn