Gossamer Forum
Home : Products : Links 2.0 : Customization :

Expiration for a resource style?

Quote Reply
Expiration for a resource style?
Hi,

Can a mod be done so the Admin can set the expiration date of a URL style? This is how I envision it.

The admin could specify via the Admin page if a link is Bold and/or Red with a date that these settings would expire.

I search the forum but didn't come across this. Any suggestion or pointers welcome.

TIA,
Keith
Quote Reply
Re: Expiration for a resource style? In reply to
Look for the Expirator Mod in the Resource Center. All you have to do is NOT print the field in the add and modify forms, so that only the Admin can set the value when the record should be deleted.

BTW: Widgetz wrote some additional add-ons to run the expirator mod via Cron to automate the process rather than having to manually execute the expirator script. Codes are available in a Thread in this Forum.

Search for expirator mod or something like that.

Regards,

------------------
Eliot Lee
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
* Say NO to Duplicate Threads. :)
----------------------











Quote Reply
Re: Expiration for a resource style? In reply to
Expirator for Links 2 deletes the URL from the db, right? What I'm looking for is the admin can set the style of a URL, like Bold and/or Red, and have the *style* of the URL to expire.

TIA,
Keith
Quote Reply
Re: Expiration for a resource style? In reply to
ah...I see...Well, you are aware that this will dramatically slow down your build process, right?

I am unsure of how to do this exactly...but I believe that you will have to use $srand with the Expired Date field.

One suggestion is to combine the Priority Logo Mod and the Expirator Mod...I think that these two Mods may shed some light on the subject.

Regards,


------------------
Eliot Lee....
* Check Resource Center
* Search Forums

Quote Reply
Re: Expiration for a resource style? In reply to
Is the expiration date related to the add (or modify) date, like say, +2 weeks? If so, you won't need an extra field, else you will need to add a field formatExpireDate...

Hey, Eliot, is AnthroRules your doppleganger?

------------------
The Immuatable Order of Modding
-=-=-=-=-=-=-=-
1. Read the FAQ, 2. Search the board, 2a. Search the board again, 3. ask the question, 4. back-up, 5. experiment, 6. rephrase question (or better yet, post solution to original question)

[This message has been edited by oldmoney (edited February 18, 2000).]
Quote Reply
Re: Expiration for a resource style? In reply to
oldmoney,

It seems that in the midst of the glitches that the Gossamer Threads Forums experienced, the deletion of my "Eliot" account was deleted...so, I created a new account.

Regards,

------------------
Eliot Lee....
* Check Resource Center
* Search Forums

Quote Reply
Re: Expiration for a resource style? In reply to
When I run nphexpirator.cgi (from the Expirator MOD Links2, http://gossamer-threads.com/scripts/resources/Attach/521-nphexpirator.txt ) I get a 500 Server Error (path is correct).
In which file should I add the field ExpireDays and how?
<i>(Add a field called ExpireDays like below
ExpireDays => [14, 'numer', 2, 2, 1, '30', '']</i>
Does nphexpirator.cgi replace nph-build.cgi or when it should be called?
Quote Reply
Re: Expiration for a resource style? In reply to
The ExpireDays needs to be added to the links.def file. Read the FAQ about adding new fields to the links.db in the Resource Center. (Remember that you have to add this new field to your existing database.)

And this script DOES NOT replace the nph-build.cgi script. All it does is deletes records from the links.db at a given day specified by the LINK OWNER.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Expiration for a resource style? In reply to
Thanks for the hint. Looks like the links .db is building up correct now with the additional field.

I still have a server error running nphexpirator.cgi (same dir as confil files, admin.cgi, nph_build.cgi ..., chmod 755, path o.k)

Is there a problem with cutting, pasting and renamimg to .cgi when trying to execute perl programs? I assume that the given code from nphexpirator.txt is correct.

Thanks for any help here.
Quote Reply
Re: Expiration for a resource style? In reply to
*sigh*

Why don't you check the syntax of the file?

Like the following:

1) Access your account via telnet.

2) Connect to the directory where the nph-expirator.cgi is located:

Code:
cd /cgi-bin/links/admin/

3) Check syntax of the file:

Code:
perl -c nph-expirator.cgi

Then copy and paste the synatx codes you receive in this Topic.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Expiration for a resource style? In reply to
First I received this syntax code :

syntax error at nphexpirator.cgi line 41, near ""site_html_templates.pl" :"
BEGIN not safe after errors--compilation aborted at nphexpirator.cgi line 43.

And I changed : to ; , then I received this :

syntax error at nphexpirator.cgi line 41, near ""$db_script_path/site_html_templ
ates.pl";"
BEGIN not safe after errors--compilation aborted at nphexpirator.cgi line 43.

And I changed line 41

$build_use_templates ?
to
$build_use_templates;

Now telnet says

nphexpirator.cgi syntax OK

But I still get a Server Error.
Quote Reply
Re: Expiration for a resource style? In reply to
Does your hosting company allow nph files to be executed via your web browser? If not, you will have to execute this file via telnet. Or you can read the FAQ about editing nph files.

Use perl nph-expirator.cgi to be execute the file. If you want a log to be created after you execute the file, use perl nph-expirator > expire.log.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Expiration for a resource style? In reply to
First I received this syntax code :

syntax error at nphexpirator.cgi line 41, near ""site_html_templates.pl" :"
BEGIN not safe after errors--compilation aborted at nphexpirator.cgi line 43.

And I changed : to ; , then I received this :

syntax error at nphexpirator.cgi line 41, near ""$db_script_path/site_html_templ
ates.pl";"
BEGIN not safe after errors--compilation aborted at nphexpirator.cgi line 43.

And I changed line 41

$build_use_templates ?
to
$build_use_templates;

Now telnet says

nphexpirator.cgi syntax OK

But I still get a Server Error.
Quote Reply
Re: Expiration for a resource style? In reply to
OOOOOPS, I'm a stupid idiot, I posted my previous message.

Thanks Eliot, I'm working on this.

Is line 41

$build_use_templates;

correct though?

Looks like this variable is a little bit lost there...???
Quote Reply
Re: Expiration for a resource style? In reply to
No...

It should be set to 0, like the following:

Code:
$build_use_templates = 0;

if you are NOT using templates.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Expiration for a resource style? In reply to
Eliot,
some things are indeed new to me, like the knowledge of the existence of nph files.

I made the changes we discussed in our posts, AND renamed nphexpirator.cgi to nph-expirator.cgi WITH the dash!

Eureka, its working!!!

However this was not clear in the MOD section, but maybe I should have known this...

Your posts cleared things up to me.Thanks
Quote Reply
Re: Expiration for a resource style? In reply to
I just tested nph-expirator.cgi and the result was negative.
I've set ExpireDays of old links in links .db manually to 1 and nph-expirator found no expired records.

Here is a breakdown of what I did :

1) Adding a form field to site_html.pl
2) Adding ExpireDays => [14, 'numer', 2, 2, 1, '30', '']
to links.def
3) Setting $build_use_templates = 0;
in nph-expirator.cgi

Have I missed something there?

Thanks for any help.
Quote Reply
Re: Expiration for a resource style? In reply to
Yep...you neglected to add the new field into your existing database. You need to read the FAQ about adding a field in the links.db that is located in the Resource Center.

If you have not added the field, then the script is unable to find the field, because your database is now corrupted.

And you are also grossly confusing file names.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Expiration for a resource style? In reply to
I've already added this field to the existing links.db.

Here is the breakdown :

1.) Adding a form field name=ExpireDays in site_html.pl (add.htm)
2.) Adding Adding ExpireDays => [14, 'numer', 2, 2, 1, '30', ''] to links.def
3.) Adding the new field to all entries in existing links.db (at Pos. 14 = at the end)(with the script provided in the FAQ)
4.) Setting $build_use_templates = 0; in nph-expirator.cgi
5.) nph-expirator.cgi says no expired records found even though I've set the ExpireDays value of old links to 1

I just would like to know if there are other files involved than mentioned above.
Quote Reply
Re: Expiration for a resource style? In reply to
And did you add a "dummy" record with a value of something like 1 to test this script?

As default, you have set "30" to be the default value...and that is 30 days, so, if you have not created a dummy record with something like 1, of course, there are no records to delete.

The script is running fine...it seems that you have not put in a dummy record to test this Mod.

Wink

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Expiration for a resource style? In reply to
Eliot, I just found the link to widgetz 'Expired Links v1.0' at http://www.widgetz.com/links_mods/expired_links/ and installed this version.

It seems to be running fine.

The MOD even has an E-Mail Notification for expired links. I havent tested that out yet but if it works I'll should stick with this one Wink

Thanks for now.