Gossamer Forum
Home : Products : Links 2.0 : Customization :

Site of the day MOD Posted here!

(Page 3 of 3)
> >
Quote Reply
Re: Site of the day MOD Posted here! In reply to
Here is a suggestion if you can't use cron tab...This mod uses a SSI to run the script(this is in addition to the include call). The script runs everytime the page is accessed, but because it compares the current date against one stored in a txt file, it'll only pick a new site once a day.

Under $txtfile = '/path/to/sotd.txt';
Add $datefile = '/path/to/datefile.txt';

At the begining of the sub main add...
Code:
my $date = &get_date;

#Check the date to see if we need to pick a new site
$olddate = "1-Jan-2000"; # Makes sure there is a valide date to check
open (DATE, "<$datefile") or print "unable to open date file Reason: $!";
$olddate = <DATE>;
close DATE;
if ($date eq $olddate) { exit; }
At the end of that same routine add...
Code:
# Sets the new date to the date file
if ($datecheck eq "1") {
open (DATE, ">$datefile") or print "unable to open logfile: $datefile. Reason: $!";
print DATE $date;
close DATE;
Next create a empty datefile and make sure it is in the location you specified at the begining of the script. Last add an SSI call like the following on your home page, or which ever page already holds the include call.
Code:
<!--#exec cgi="/cgi-bin/links/sotd.pl" -->
NOTE: for this mod to work you will need to make sure that your sotd.pl is NOT in a password protected directory or else you will get an include error.

If you have used widgetz verison, you will want to remove these two lines from the code or else they will print out on your home page.
Code:
$ENV{'REQUEST_METHOD'} and print "Content-type: text/plain\n\n";
print "ID: $rec{$db_key} Title: $rec{'Title'}\n";

This mod isn't fancy, but it works well. It's been working on my site for 2 weeks now with no problems and without any effort from me.

Good Luck,
Sheldon

------------------
webmaster@gottabounce.com
www.gottabounce.com

Quote Reply
Re: Site of the day MOD Posted here! In reply to
I've the script working, it writes etc, and I can call it from the browser, however i am getting an error occurred while processing this directive message from the SSI call - tried all forms of paths and made sure that the index was a .shtml file

anyone get this called into a ssi page (BTW - I don't have crontab access)

Thanks
Quote Reply
Re: Site of the day MOD Posted here! In reply to
Using SSI and Crontab are two different things.

hotwheels,

The easiest thing to do is use the following codes:

Code:
<!--#include virtual="/path/to/siteday.txt"-->

Change /path/to to the VIRTUAL path where your siteday.txt file is located.

Like if the siteday.txt file is located in the /cgi-bin/links/admin/data/ directory, then you would use the following codes:

Code:
<!--#include virtual="/cgi-bin/links/admin/data/siteday.txt"-->

REALLY hope this helps.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Site of the day MOD Posted here! In reply to
still got the error - i've already tried all sorts of paths and no go, but...brb

Success!

It was the virtual call to the file location upwards of the cgi-bin directory - when I placed the txt file in a directory lower than the cgi-bin it worked

I remember that happening about two years ago on this same server with another call, should have remembered!

Thanks
Quote Reply
Re: Site of the day MOD Posted here! In reply to
Good...

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Site of the day MOD Posted here! In reply to
As I stated three times in two other Topics in the Forums, I am working on this type of modification. I don't gaurantee I will post the modification, BECAUSE it will not be easy to install for NOVICE users like you.

Wink

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Site of the day MOD Posted here! In reply to
Hi !!!

Is it possible to create a site of the day in to determinate category ???

Any ideas ???

Marco Aurélio

Quote Reply
Re: Site of the day MOD Posted here! In reply to
Just installed Site of the Day.

When I run the program I get this error ( I get the error even when I build my
site )

Error including libraries: syntax error at /data1/hypermart.net/moneysearch/cgi-bin/admin/site_html.pl line 890, near "* })
"
Missing right bracket at /data1/hypermart.net/moneysearch/cgi-bin/admin/site_html.pl line 2282, at end of line

Make sure they exist, permissions are set properly, and paths are set correctly.


Now if I just remove the code from my site_html.pl
--------
sub site_html_site_of_the_day {
# -------------------------------------------
# This routine determines how the sotd page will look like.

my %rec = @_;
$output = qq~
PUT YOUR HTML HERE (you can use $rec{ ***** })
~;
return $output;
}


I can then build my site with it removed.
I get the error with it in there.

Thanks
John
Quote Reply
Re: Site of the day MOD Posted here! In reply to
Uh...are you using EXACTLY the codes you've posted...if so, you are using special Perl characters, including the $ sign.

Here is an example of what you need:

Code:
sub site_html_site_of_the_day {
# -------------------------------------------
# This routine determines how the sotd page will look like.

my %rec = @_;
$output = qq~<a href="$rec{'URL'}">$rec{'Title'}</a>
return $output;
}

Get it? Got it? I hope so.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.
Quote Reply
Re: Site of the day MOD Posted here! In reply to
Thanks you it worked, Kind of.

I think you for got to put in

~;

I put one of those in and it worked.

But thank you..

after you do this, how do you get it to work?
I ran the site_of_the_day.pl program by using my web browers to and typing in the url. it wrote the .txt file but gave an 500 server error.

Do you know if this is ok?
Also where are there good instructions on how to run cron?

Thanks
John
Quote Reply
Re: Site of the day MOD Posted here! In reply to
If you are using the original siteofday.pl file, then you will get the error message via your browser. So, it is fine, since the .txt file is created.

The better solution to REALLY make this a Site of the Day Mod is to execute the script via Cron. Read the FAQ about Crontab in the Resource Center.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.
Quote Reply
Re: Site of the day MOD Posted here! In reply to
Please help me
My sever doesn't support ssi or Cron
and I am using templates.
So I want get this mod working
please tell me what codes I have to use.
Thanks.


Quote Reply
Re: Site of the day MOD Posted here! In reply to
Is there any chance you could send me the Site_of_the_day.pl file as a text file because when I try to copy and paste from the forum, the code gets messed up and I get an internal server error!

Thanks.

From Paul Wilson.
http://www.audio-grabber.com
On error resume next..
Quote Reply
Re: Site of the day MOD Posted here! In reply to
Hello,

I'd like that de site of the day are display on home.html. Not a link, but the site with name and the description and score... Not a link to another page...

Possible ?

Laurent

Quote Reply
Re: Site of the day MOD Posted here! In reply to
Hello all,

Any idea how to pull out 5 site of the day or any number of site instead of only one from the database ?

Please help and thank you.

Quote Reply
Re: [reenee] Site of the day MOD Posted here! In reply to
any solution on this topic?

tenx

Gregor
Quote Reply
Re: [Vs_Greg] Site of the day MOD Posted here! In reply to
Solution for what?

Note: Check out the Top X SSI Mod form DelPiero (This modification allows you to use an external Links 2.0 .shtml file within the Top X links by category.)




Quote Reply
Re: [cK] Site of the day MOD Posted here! In reply to
hi .. i would like to use this SOTD mod .. since it is already working .. but would like to have 5 links in sotd.txt .. not just one

Gregor
> >