Gossamer Forum
Home : Products : Links 2.0 : Customization :

Link of the Day

(Page 1 of 2)
> >
Quote Reply
Link of the Day
Another short Link-Of-the-day description:

just type in lotd.pl
-------------------------------
#!/usr/bin/perl

$file="/path/to/your/cgi-bin/admin/data/links.db";
$nummer=`date +%d`;
$date=`date +%d.%m.%y`;
open (IN,$file) | | die "Content-Type: text/us-ascii\n\nOsorry no files???\n";
@in = <IN>;
($nr,$name,$url,$dat,$cat,$beschreibung,$namee,$email,$eins,$zwei,$drei,$vier,$fuenf) = split(/\Q|\E/o,$in[$nummer]);
($url,$name,$beschreibung)=~s/"//g;
print "Content-Type: text/html\n\n";
print "<b>$date</b><br>";
print "<a href=\"$url\" target=\"_new\"><b>$name</b></a><br>$beschreibung\n";
------------------------

And add an SSI-Call to your index.html template :-)

thats all :-)
Quote Reply
Re: Link of the Day In reply to
I changed all the fields to match my own, but it still don't work...

To your 'own' link of the day mod: how do you call the link of the day in your index.html file??
Quote Reply
Re: Link of the Day In reply to
 
Quote:
To your 'own' link of the day mod: how do you call the link of the day in your index.html file??

At my site the script is called with a cron event (or by hand) and with the little sub routine you have to place in site_html_templates it writes a litlle textfile with only the <a href... line in it.

With a SSI (server side include) statement I place that in the right place in my template.

Each time the homepage is called by a user the server will replace the SSI tag with the textfile the script writes. And there is my site of the day link.

It seems simple but a lot can go wrong. Make sure the file permissions are correct. And so on.

Jeroen

------------------
Free 4U2: a searchable directory of free stuff
http://www.free4u2.com

When something does not function properly, hit it hard.....
.....When it breaks it had to be replaced anyway.


Quote Reply
Re: Link of the Day In reply to
I tried it out, but it doesn't work! I think the error could be in:

@in = <IN>;
($nr,$name,$url,$dat,$cat,$beschreibung,$namee,$email,$eins,$zwei,$drei,$vier,$fuenf)

but I don't know... Who tried, too and got it to work??? I NEED A WORKING SITE OF THE DAY MOD!!!
Quote Reply
Re: Link of the Day In reply to
Check out: http://www.gossamer-threads.com/...um3/HTML/002451.html

I explained it there....

Jeroen

------------------
Free 4U2: a searchable directory of free stuff
http://www.free4u2.com

When something does not function properly, hit it hard.....
.....When it breaks it had to be replaced anyway.


Quote Reply
Re: Link of the Day In reply to
I already checked out this thread, but I can't use cron. Isn't there any other way to generate a Site Of The Day mod??? People out there are generating hard to create mods all the time, but why are there so less who could create a simple, but working Site/Link Of The Day mod...
Quote Reply
Re: Link of the Day In reply to
I noticed that the script in the first post of this thread is using German field names. Do you also have German filenames??

That could be the problem why it's not working. Just a guess.

I'm not that into perl myself, but when you cannot use cron, you got to have some script that calculates a number from the date. This number could be the ID from the link of the day. There only should be some sort of checking routine that checks if the ID number exists.

As simple as I put it here, as complicated it will get to program such a script. You could use the script I mentioned in my previous post. But as I said you have to start it manually then every day. If you validate links or doing anything in admin every day that should not be a problem then.

Jeroen

------------------
Free 4U2: a searchable directory of free stuff
http://www.free4u2.com

When something does not function properly, hit it hard.....
.....When it breaks it had to be replaced anyway.


Quote Reply
Re: Link of the Day In reply to
Yes, I know that there're German filenames (I'm a German), but I don't use them by myself... Where do I find the $nr, $name $url tags in the scripts to replace them with my own tags?? Maybe the mod could work if I change the German things to my own, but the mod is SO small that there HAVE to be more stuff to work, right?
Quote Reply
Re: Link of the Day In reply to
Try to change all the occurances of German field names with the names you use in your database.

I also believe that you have to replace the fields in this line:

Quote:
@in = <IN>;
($nr,$name,$url,$dat,$cat,$beschreibung,$namee,$email,$eins,$zwei,$drei,$vier,$fuenf) = split(/\Q|\E/o,$in[$nummer]);

With all the fields in your DB in the same order as they appear in your in your links.cfg

Try playing with it a bit, but keep the syntax from the original script untouched. Which field names you use is not important. What is, is the number of fields you DB has.

Jeroen

------------------
Free 4U2: a searchable directory of free stuff
http://www.free4u2.com

When something does not function properly, hit it hard.....
.....When it breaks it had to be replaced anyway.


Quote Reply
Re: Link of the Day In reply to
I made alll the changes like described and executed the site_of_the_day.cgi file, but I get the following error message:

CGI ERROR
==========================================
Error Message : fatal error: Undefined subroutine &main::site_html_site_of_the_day called at site_of_the_day.cgi line 71.

Script Location : site_of_the_day.cgi
Perl Version : 5.00503

...........

What have I done wrong??
Quote Reply
Re: Link of the Day In reply to
you need the sub site_html_site_of_the_day inside of site_html_templates.pl or site_html.pl

so it would print the html
Quote Reply
Re: Link of the Day In reply to
Oooohhh, don't I have to call the site_of_the_day.cgi with SSI?? I included the stuff in site_html.pl, but what do I have to call with SSI??
Quote Reply
Re: Link of the Day In reply to
You have to call the text file the script writes. In the sub routine there's a place that say place HTML here. There you could specify what to write to the text file.

I do not have telnet access here but I could give you an example of my code tomorrow.

I'll post it in this thread.

Jeroen

------------------
Free 4U2: a searchable directory of free stuff
http://www.free4u2.com

When something does not function properly, hit it hard.....
.....When it breaks it had to be replaced anyway.


Quote Reply
Re: Link of the Day In reply to
This is what I've added in site_html:

sub site_html_site_of_the_day {
# --------------------------------------------------------
# This routine determines how the sotd page will look like. #
my %rec = @_;
$output = qq~ <b><a href=\"$URL\">$Title</a></b> - $Description<br>($URL - Added: $Date)~;
return $output;}

If there's sth. wrong, please correct it!!
Quote Reply
Re: Link of the Day In reply to
Mine is slightly different from yours:

sub site_html_site_of_the_day {
#--------------------------------------------
# This routine determines how the sotd page will look like.
my %rec = @_;
$output = qq~ <b><a href=\"http://mydomain.com/cgi-bin/jump.cgi?ID=$rec{ID}\">$rec{Title</a></b> - $rec{Description}<br>($rec{$URL} - Added: $rec{Date})~;
return $output;}

Try that for a change,

Jeroen.



------------------
Free 4U2: a searchable directory of free stuff
http://www.free4u2.com

When something does not function properly, hit it hard.....
.....When it breaks it had to be replaced anyway.


Quote Reply
Re: Link of the Day In reply to
I tried it, but I still get the same error message when I execute the cgi-file to build the .txt file. Anyway, I tried to paste some code in the .txt file and called it via SSI, but it doesn't show anything!!!
I use the following SSI-call: <!--#exec cgi="/cgi-bin/siteoftheday.txt"-->
is this call right?? Maybe there's a mistake in the link_of_the_day.cgi file, but I just changed the settings required...
Quote Reply
Re: Link of the Day In reply to
   
Quote:
I use the following SSI-call: <!--#exec cgi="/cgi-bin/siteoftheday.txt"-->

Try using <!--#include file="/cgi-bin/siteoftheday.txt"-->

If that doesn't work try:
<!--#include file="siteoftheday.txt"-->

And write the txt file in the same directory as your homepage.

Jeroen



------------------
Free 4U2: a searchable directory of free stuff
www.free4u2.com

When something does not function properly, hit it hard.....
.....When it breaks it had to be replaced anyway.




[This message has been edited by Jeroen (edited August 07, 1999).]

[This message has been edited by Jeroen (edited August 07, 1999).]
Quote Reply
Re: Link of the Day In reply to
Oh and I forgot to tell: when starting the script in your browser it gives you an error. But it will write the text file.

Just ignore the error. It is supposed to be called via a cron job, not via your browser.

Jeroen

------------------
Free 4U2: a searchable directory of free stuff
http://www.free4u2.com

When something does not function properly, hit it hard.....
.....When it breaks it had to be replaced anyway.


Quote Reply
Re: Link of the Day In reply to
I checked it out & now the SSI-call works with myself edited .txt file. But building the .txt file with the perl script still doesn't work!! Could you please post the code of your script anytime to check if there's sth. missing???
Quote Reply
Re: Link of the Day In reply to
Here are the first couple of lines:

#!/usr/bin/perl
#################################################################
# Set up Variables
#################################################################

$txtfile = '/opt/guide/HTML/txt/generated/siteoftheday.txt';

#################################################################
# Main Script
#################################################################

# Required Librariers
# --------------------------------------------------------

eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX /
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \

require "admin/links.cfg"; # Change this to full path to links.cfg if you have problems.
require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";


Where it says:
$txtfile = '/opt/guide/HTML/txt/generated/siteoftheday.txt';

Change the value between the quotes for your full server path to the location where your textfile is written.

Where it says:
require "admin/links.cfg";

Change that to:
require "links.cfg";

But only when you have placed the script in your admin dir.

I hope this helps.

Jeroen

------------------
Free 4U2: a searchable directory of free stuff
http://www.free4u2.com

When something does not function properly, hit it hard.....
.....When it breaks it had to be replaced anyway.


Quote Reply
Re: Link of the Day In reply to
I have this all done like here...
But I found a line which could have an error in it:

require "$db_lib_path/site_html_templates.pl" :

Why is there a ':' at the end of the line, and not a ';'?? I tried to change it to ';' but then I got a server error...
Quote Reply
Re: Link of the Day In reply to
It should be : (i think)

Do you use templates or not?

If you use templates you can use instead of:
$build_use_templates ?
require $db_lib_path/site_html_templates.pl" :
require "$db_lib_path/site_html.pl";

Only: require $db_lib_path/site_html_templates.pl";

If you do not use templates use:
require "$db_lib_path/site_html.pl";

Try that dont forget to remove:
$build_use_templates ?

I think this will be my last post of the day. I'm at work and I go home in a few minutes. Get some sleep.
Jst post if you still have problems, will read it tomorrow.

Jeroen.

------------------
Free 4U2: a searchable directory of free stuff
http://www.free4u2.com

When something does not function properly, hit it hard.....
.....When it breaks it had to be replaced anyway.


Quote Reply
Re: Link of the Day In reply to
noone has ever said what kind of subroutine to use in site_html_templates before, but i use templates, and i have wanted the link of the day, site of day and the other one for while but don't know how to convert it.

------------------
------------------------------------------
Lavon Russell
LookHard! Search
http://www.lh.yi.org
webmaster@lh.yi.org
Quote Reply
Re: Link of the Day In reply to
I GOT IT TO WORK!!!!! YEAAAAAH!!! The error was so simple: I included the sub in the wrong file - not site_html.pl, but site_html_templates.pl.
Now I would like to check out, if my provider supports cron - how can I do this, and by the way; what is cron at all??
Quote Reply
Re: Link of the Day In reply to
 
Quote:
I GOT IT TO WORK!!!!! YEAAAAAH!!!

Congratulations......

Quote:
Now I would like to check out, if my provider supports cron - how can I do this, and by the way; what is cron at all??

The best thing you could do is send an email to the help desk of your provider.
If you want to know more about cron you could telnet to your account and type:
man cron at the prompt.

cron is basicly the task scheduler of Unix. The OS most webservers use.

Jeroen

------------------
Free 4U2: a searchable directory of free stuff
http://www.free4u2.com

When something does not function properly, hit it hard.....
.....When it breaks it had to be replaced anyway.


> >