Gossamer Forum
Quote Reply
Expirator
I need an option to my user to choose how many days the clasiffied will show at the category, they're 15,30,45,60 days (scrool down box), at the end of
period, the classified will delete from database. Can this be make it with Links
SQL ?

Please help.

Last edited by:

reenee: Jan 3, 2002, 12:05 PM
Quote Reply
Re: [reenee] Expirator In reply to
 You'd really need a plugin, and a cron job to do it.

There are two ways to do the expirations.

The old way to do it would havve been to enter a number -- 15, 30, 45, etc into the "Expired" field, which would be an integer. Every day, your cron job would run, and subtract 1 from the date until it gets to 0. You can then use "if expired" or "ifnot expired" to test the field.

The "new" way, is to use a date field "Expires_On", where you have to do a date calculation for each record, every time you use it, and figure out if the Expires_On date is less than todays' date. You also need to do an initial date calculation to set the date x-number of days ahead of the submitted form date.

The reason I say old and new, is that the first way is based on how flat-file databases would prefer to run. It's simpler, and requires a lot less overhead. You run your cron job during a low-traffic point of the day. It _can_ run in a MySQL or RDBS system, but it's better in such a system to use an "expires_on" date, and you then don't have to run a cron job. If your system goes down, and the cron job doesn't run for some reason, the "expires_on" date still will cause the record to be expired properly.

Either way, though, you need to have some extra overhead to do it.

Exactly how, and which way is better, actually depends on your needs.




PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Expirator In reply to
Hi Pugdog,

Thanks for the answer, for me, i choose the old one, i dont know why i choose the old one, my be my impression and very limit knowledge in programming, and the second thing, my english is so bad Laugh. Well, do you have a simple code to make it ?

Please help and thank you so much.

Quote Reply
Re: [reenee] Expirator In reply to
Well, the hard part is to debug the script that will run by the cron job.

You need to add a field to the Links table "expired" and make it an Int or small Int.

The rest of the use would be in your templates by using <%if expired%> tags.

If you want the ads deleted when they expire, this should be part of the cron script.

It needs to:

delete from Links where Expired=0

and run right after the cron script that decrements the date.

Update Links Set expired=expired-1 where Expired > 0

In your templates, if <%Expired%> is greater than 0, the ad is not expired, so
it actually works backwards -- you might want to rename the field -- but I
prefer just using a more complete test --

<%if Expired >0%> rather than the short hand <%if Expired%>




PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Expirator In reply to
Hi Pugdoq,

Thanks for the answer, but i still blur some of explanation, please help:

In Reply To:
You need to add a field to the Links table "expired" and make it an Int or small Int.

Yes, i add the new table follow the instruction above with the 'Column Name: Expired' --> 'Column Type: INT' --> 'Column Index: None' --> 'Not Null: No' --> 'Form Type: Select' -->
'Form Name: 15 30 45 60' --> 'Form Values: 15 30 45 60' -->

My problem now, i still dont understand how to make the next step as below, Please help to give more detail how to make it .. Thanks.

In Reply To:
The rest of the use would be in your templates by using <%if expired%> tags.

If you want the ads deleted when they expire, this should be part of the cron script.

It needs to:

delete from Links where Expired=0

and run right after the cron script that decrements the date.

Update Links Set expired=expired-1 where Expired > 0

In your templates, if <%Expired%> is greater than 0, the ad is not expired, so
it actually works backwards -- you might want to rename the field -- but I
prefer just using a more complete test --

<%if Expired >0%> rather than the short hand <%if Expired%>
Quote Reply
Re: [reenee] Expirator In reply to
The next part is the hard part :)

If you play with the new fields, you should see that you can make links display as "Expired" or "About to Expire" by using the Expired field.

I would have to think about the .cgi script, since it's not something I've done before. Basically, it would just need to load the standard Links headers, and connect to the database, and issue the queries.

The big thing is to decide if you want "expired" ads to still show up, or just be deleted. This affects the queries, and the code you would use in your templates as well.




PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Expirator In reply to
Huwaaaaaa Unsure....I still dont understand how to make it, I just need the ads will remove automatically from database and no more show up since it was expired... Please help
Quote Reply
Re: [reenee] Expirator In reply to
Hello All,

I really need help with this thing, with so limit in programming, i really no idea how to make it ..can somebody else out there help me please ...

Thanks so much.


Quote Reply
Re: [reenee] Expirator In reply to
There's a timestamp by default in the link table so how about adding a new column called "Expires" and adding this to the add form (maybe use a select list of days eg... 1 2 3 4 5 6 7 8 9)

....then you can insert it into the Expires column.

Then set up a script by cron to check if the current time is greater than (Timestamp + (Expires * seconds in a day)) .

...if so it has expired.






Last edited by:

RedRum: Jan 6, 2002, 1:42 AM
Quote Reply
Re: [RedRum] Expirator In reply to
In Reply To:
Then set up a script by cron to check if the current time is greater than (Timestamp + (Expires * seconds in a day)) .

...if so it has expired.

Somebody please help me, how to create the thing Redrum suggest above.

Please help, I really desprated with the mod.
Thanks.
Quote Reply
Re: [pugdog] Expirator In reply to
I am very interested in a plugin (or mod) for handling 'expired' links. I am strongly considering LinksSQL as the platform of choice for listing vacation properties. This will be a commercial site -- property owners will pay to have their site(s) listed. A requirement, then, is that these links (or, more specifically, detailed pages) must expire once their term has been reached.

Ideally, I would want to see something similar to the Links2 Expirator mod. This permitted you to email the link owner once the link had expired and give them an option to update (renew). I've searched throughout this forum and, as yet, have not found anything elsewhere that discusses an expiration mod/plugin that has been created (pointers, of course, are welcome).

So, bottomline: For my needs, LinksSQL (and it's plugins) appears to have -everything- I want EXCEPT for link expiration. If this hurdle can be overcome, Alex may just have another LinksSQL sale!

Thanks!
Quote Reply
Re: [Andrew Mitcham] Expirator In reply to
Hi Andrew!

Well, Expirator feature will be available sometime in the near future as plugin, when I will have time to finish it for Links SQL 2.1.
It will be a commercial plugin, but will be sold for a fair price ($60) which will include unlimited free upgrades & 1 year free email support.

Please read this thread about this subject.
We discussed all the wished Link Expirator features in details, so you can decide if you are interested in:
http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=181959

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] Expirator In reply to
I read your thread and I am excited by the potential. And the price sounds entirely reasonable. Please keep us up to date!

Thanks!
Quote Reply
Re: [Andrew Mitcham] Expirator In reply to
I posted a new thread in the Globals/Plugins area. If there are any takers, follow the directions :)


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [Andrew Mitcham] Expirator In reply to
I have reached the point, when I start the development of the expirator plugin.

I'm afraid, you should ignore the price info, I wrote earlier.
The price and license aggreement terms will be published only, when the final release will be done.

Sorry, it was my mistake, that I posted price on something, that was even just an idea at that time.
Paul is right, I have to be more careful, how much tasks (including developments, email & forum support, bug fixes) I can take over. The price and license terms will also depend on this.

I opened a new thread about my new planned plugin Advanced Link Expirator plugin (ALE), on which I just started the development work.
You can find description, feature summary, detailed list of planned features, and links to Expiration related threads collected into the following thread:
[PLUGIN] Advanced Link Expirator plugin (ALE) development news
(I hope, the related threads links on the page above, will be help you to find the popular expiration related threads I found)

Please note (FYI):
There are several expirator plugins under development. The mentioned plugin is developed, by me, Webmaster33. Pugdog, also have an expirator plugin under development, so about his plugin ask him. Others may also have expirator plugin under development, so do not confuse the plugins.

EDIT: By the way, here is Pugdog's thread about his developed expiration plugin:
Expirator, Expiration Mod, etc,

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Sep 2, 2002, 5:45 AM
Quote Reply
Re: [webmaster33] Expirator In reply to
Thanks for the input. As it turns out, I have gone forward with another product. It isn't perfect, but it suits my needs for the time being.

Regards,

Andrew Mitcham
http://EconoCondo.com/
Quote Reply
Re: [Andrew Mitcham] Expirator In reply to
Ok, no problem.
The only thing does matter, to fit your needs (at least temporarily).
Check back sometimes, if you think an Advanced Link Expirator plugin could fit your needs.
I also very need the expirator plugin, so I try to finish it ASAP.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...