Gossamer Forum
Home : Products : Links 2.0 : Customization :

OK, Before anyone screams at me.....

Quote Reply
OK, Before anyone screams at me.....
Can someone PLEASE PLEASE tell me how to make the expirator mod use the "Date" and not the "Days" ???

I have searched countless hours reading post after post after post. And nothing seems to work.

I saw some stuff from widget (?) and checked on that, and none of the links or anything work anymore.

I sure wish someone could help me, I've been struggling to find this for a couple days. I know some people get mad about asking the same questions, but I did search the bloody hell outta the forum, and can't come up with nothing concrete.

Please help....

Thanks!


dunno

God Bless our Great Nation

God Bless every Family involved in the Tragedy

God Bless all Rescue Efforts

God Bless Peace on Earth


Quote Reply
Help Please?? In reply to
Can someone please help me on this? I really need to get this working, and I waited couple days for replies before posting again...

Please help...

Thanks again,
dunno

God Bless our Great Nation

God Bless every Family involved in the Tragedy

God Bless all Rescue Efforts

God Bless Peace on Earth


Quote Reply
Re: [dunno] Help Please?? In reply to
Can someone please help me out?? This is very important.

I know SOMEONE out there uses the expirator mod, WITH the date, and not the number of days....

Can you please send me a copy, post a copy, or tell me where to get a copy of it?? Or how to do it, something?????

Thanks again,


dunno

God Bless our Great Nation

God Bless every Family involved in the Tragedy

God Bless all Rescue Efforts

God Bless Peace on Earth


Quote Reply
Re: [dunno] OK, Before anyone screams at me..... In reply to
Ok, I didn't like having to count all the time to expire a record, So I dug through the forums and built my own. it builds an expiring page that adjusts to spanning pages by building the flip side of the new routine.

###### Notice, I only pieced this up to work for me. I do not know perl, Most everthing here comes from forum posts, and is of course contaminated with my own setup, 3x text links 10 star ratings ect. If you want to play with this go ahead, but Boy was it a pain in the a** to get working and its been over a year so my memory has faded.

No Warranty, No support, No promises other than it worked for me.
Bear

In Links Def
################
DateExpires => [25, 'date', 15, 15, 0, , ''],
isExpiring => [27, 'alpha', 0, 5, 0, 'No', ''],

$db_dateexpires = 25;
$db_isexpiring = 27;

# Hash of column names to possible options. If you want to use a select form
# field, you can use &build_select_field in your HTML page. This routine will
# make a <SELECT> input tag using the following values:
%db_select_fields = (
isNew => 'Yes,No',
isPopular => 'Yes,No',
ReceiveMail => 'Yes,No',
isBest => 'Yes,No',
isExpiring => 'Yes,No',
insured => "Agency,Self,Unknown"
);


###############

In Links Cfg
########################
#####ADDED by expire mod
# PATH and URL of What's Expiring page. No Trailing slash.
$build_expiring_path = "$build_root_path/Expiring";
$build_expiring_url = "$build_root_url/Expiring";
#####END added by expire mod

and in links.cfg

# Build Options
# --------------------------------------------------------
# Setting for popular cutoff, can either be a percent (i.e. top 3%), or
# a fixed value (i.e. top 10). Enter 0.03 or 10 respectively.
$db_popular_cutoff = 0.03; # Top 3%
# Number of days a link is considered New.
$db_new_cutoff = 14; # 14 days old.
#####ADDED by expiring mod
# Number of days a link is considered Expiring.
$db_expiring_cutoff = 90; # 14 days left.
#####END added by expiring mod
# Return search results bolded (1 = yes, 0 = no).
$search_bold = 1;
# The name of an index file.
$build_index = "index.htm";
# The extension to use for non index files:
$build_extension = ".htm";

##############################
Site_html_templates I added

Above globals for 3x expiring
$expiring_1 = qq|<small><small class="expiring">expiring</small></small>|;
$expiring_3 = qq|<small><small class="expiring1">expiring</small></small>|;
$expiring_7 = qq|<small><small class="expiring2">expiring</small></small>|;
and of course you will need to edit links.css

and later

sub site_html_expiring {
# --------------------------------------------------------
# This routine will build a what's expiring page.

return &load_template ('expiring.html', {
total => $total,
grand_total => $grand_total,
link_results => $link_results,
title_linked => $title_linked,
hb_date => $hb_date,
%globals
} );
}

Dont forget to build the expiring.html
tags
<p>
<%title_linked%>
</p>

<h1>
<%site_title%>
: What's Expiring
</h1>

<%nav_bar%>

<h2>
<%total%>
Expiring Links:
</h2>
<%link_results%>

<%nav_bar%>
####################################
In NPH Build cgi

I never added it to staggered

in build all
#####ADDED by expire mod
# Deleting expired links.
print "Deleting expired links . . .\n";
&delete_expired;
print "Done.\n\n";
#####END added by expire mod

AND!!
#####ADDED by Expiring mod
# Create What's Expiring Page
$use_html ?
print "Building <A HREF=\"$build_expiring_url/$build_index\">What's Expiring</A> Page . . .\n" :
print "Building What's expiring Page . . .\n";
&build_expiring_page;
print "Done\n\n";
#####END Added by expire mod



ADD this to build the pages
#############################
sub build_expiring_page {
# --------------------------------------------------------
# Creates a "What's Expiring" page. Set $build_span_pages to 1 in links.cfg
# and it will create a seperate page for each date.
#
my (%link_output, $category_clean, $long_date, $category, $date,
$number_links, $main_link_results, $main_total, %span_totals);
local ($total, $link_results, $title_linked);

# Let's build the What's Expiring directory.
if ($build_expiring_path =~ m,^$build_root_path/(.*)$,) {
&build_dir ($1);
}

# Now we go through all the expiring_links (which are organized by category), and
# build the html in array indexed by date then category.
$total = 0;
CATEGORY: foreach $category (sort keys %expiring_links) {
LINK: for ($i = 0; $i < ($#{$expiring_links{$category}}+1) / ($#db_cols + 1); $i++) {
$total++;
%tmp = &array_to_hash ($i, @{$expiring_links{$category}});
${$link_output{$tmp{'DateExpires'}}}{$category} .= &site_html_link (%tmp) . "\n";
$span_totals{$tmp{'DateExpires'}}++;
}
}

# Then we go through each date, and build the links for that date. If we are spanning
# pages, we will create a seperate page for each date and need to set up a few other
# variables (like title and total). We will also want to reset links_results each time.
DATE: foreach $date (sort { &date_to_unix($a) <=> &date_to_unix($b) } keys %link_output) {

$long_date = &long_date ($date);
if ($build_span_pages) {
$link_results = "";
$total = $span_totals{$date};
$title_linked = &build_linked_title ("Expiring/$date");
}
else {
$link_results .= "<p><strong>$long_date</strong>\n<blockquote>";
}
CATEGORY: foreach $category (sort keys %{$link_output{$date}}) {
$category_clean = &build_clean ($category);
$link_results .= qq|<P><A HREF="$build_root_url/$category/$build_index">$category_clean</A>\n|;
$link_results .= ${$link_output{$date}}{$category};
$hb_date = $date;

}

# Crete the expiring page, and do a bit of HTML work for the main page.
if ($build_span_pages) {
open (EXPIRING, ">$build_expiring_path/$date$build_extension") or cgierr ("unable to open what's Expiring page: $build_expiring_path/$build_index. Reason: $!");
$use_html ?
print qq|\tExpiring Links for <a href="$build_expiring_url/$date$build_extension" TARGET="_blank">$date</a>: $total\n| :
print qq|\texpiring Links for $date: $total\n|;
print EXPIRING &site_html_expiring;
close EXPIRING;
$main_link_results .= qq|<li><a href="$build_expiring_url/$date$build_extension">$long_date</a> ($total).|;
$main_total += $total;
}
else {
$link_results .= "</blockquote>";
}
}

if ($build_span_pages) {
$link_results = "<ul>$main_link_results</ul>";
$total = $main_total;
}
$title_linked = &build_linked_title ("Expiring");
$hb_date = $date;


# Build the main What's Expiring page.
open (EXPIRING, ">$build_expiring_path/$build_index") or cgierr ("unable to open what's expiring page: $build_expiring_path/$build_index. Reason: $!");
print "\tTotal Expiring Links: $total\n";
print EXPIRING &site_html_expiring(@expiring_links);
close EXPIRING;
}
##################
ADD to end of script this is from another post in the forum

sub delete_expired {
# --------------------------------------------------------
# Deletes all the expired links.
#
my ($output, $days, @values, @delete);
my $date = &get_date;
my $time = &get_time;

open (DB, "<$db_file_name") or &cgierr ("Error in nph-build.cgi. Unable to Open Database: $db_file_name. Reason: $!");
LINE: while (<DB>) {
/^#/ and $output .= $_ and next LINE;
/^\s*$/ and next LINE;
chomp;
@values = &split_decode($_);


$days = &date_to_unix($date);
$dexp = &date_to_unix($values[$db_dateexpires]);
next if (($days > $dexp) && ($dexp > 0));
$output .= "$_\n";
}
close DB;

open (DB, ">$db_file_name") or &cgierr("Error in nph-build.cgi. Unable to Open Database: $db_file_name.\nReason: $!");
if ($db_use_flock) {
flock(DB, 2) or &cgierr ("Unable to Get Exclusive Lock on $db_file_name.\nReason: $!");
}
print DB $output;
close DB;

print "Done! [Start $date $time / Finish " . &get_date . " " . &get_time . "]\n";
}


Hmm, Just noticed I'm still a "novice" How long does a body have to hang out in these forums before you get "upgraded" to Lurker? LOL



Bear
Lord! Just once let it work right the first time!

Last edited by:

mebear: Oct 17, 2001, 2:27 AM
Quote Reply
Re: [dunno] Help Please?? In reply to
i actually held on to a copy of widgetz' free version of his mod that used numbers, and just modded it to use dates. Emails the admin a log file, and the user. <- That was already implemented. Pretty much all i had to do was the date. Other than that it is an impressive script. It probably isn't that hard to do a build of links that will expire.
I used Date::Manip so if it is overdue for deletion, it will show how many days, weeks, months, years, etc it is overdue.
you can see it at http://lh.links247.net/...dmin/nph-expired.cgi
Smile
btw..
usually, debug mode is a checkbox but i changed it for now.
Lavon Russell
LookHard Mods
lavon@lh.links247.net

Last edited by:

Bmxer: Oct 17, 2001, 1:04 PM
Quote Reply
Re: [Bmxer] Help Please?? In reply to
<<It probably isn't that hard to do a build of links that will expire.>>

If I managed something workable just from reading the posts, How hard can it be? Smile

Its the bells and whistles that get ya crazy and the one your running has all of them. My simple little hack is humbled in its presence. Kudos



Bear
Lord! Just once let it work right the first time!
Quote Reply
Re: [mebear] Help Please?? In reply to
yours looks good, but i can see how you have it made specifically for your system. I used to do that with mods, but it became so hard to release them. Wink
Lavon Russell
LookHard Mods
lavon@lh.links247.net
Quote Reply
Re: [mebear] OK, Before anyone screams at me..... In reply to
Mebear;

I follow you until I get here. Where is this supposed to go in site_html_templates.pl ?


Site_html_templates I added

Above globals for 3x expiring
$expiring_1 = qq|<small><small class="expiring">expiring</small></small>|;
$expiring_3 = qq|<small><small class="expiring1">expiring</small></small>|;
$expiring_7 = qq|<small><small class="expiring2">expiring</small></small>|;

And not sure where this goes in nph_build.cgi, I think build all sub somewhere.

AND!!
#####ADDED by Expiring mod
# Create What's Expiring Page
$use_html ?
print "Building <A HREF=\"$build_expiring_url/$build_index\">What's Expiring</A> Page . . .\n" :
print "Building What's expiring Page . . .\n";
&build_expiring_page;
print "Done\n\n";
#####END Added by expire mod


If anyone can help it wourld be appreciated.

Thanks,

Jake