Gossamer Forum
Home : Products : Links 2.0 : Customization :

Last Link in cgi?

(Page 1 of 2)
> >
Quote Reply
Last Link in cgi?
Can anyone write a cgi file that will call the last links in the data base on a shtml page? that is not neccesarilly genrated by the links engine but just a random page anywhere on my site?

And also could this page's layout be generated by template also?

Anyone?

Widgetz?

Elliot?

Help!
Quote Reply
Re: Last Link in cgi? In reply to
Uh..Go to the Resource Center and download and install the lastlink Mod!

Regards,

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







Quote Reply
Re: Last Link in cgi? In reply to
Elliot the lastlink mod dosent work like ssi!!!
i cant just put
<%lastlink%> on anypage...it doesnt work
Quote Reply
Re: Last Link in cgi? In reply to
Uh...You have to define the tag in your sub site_html_home page in the following manner:

Code:
lastlink => $lastlink,

It will not work on other web pages, unless you use the same LASTLINK codes that you are using in the sub_build_home_page routine IN ALL OTHER sub-routines.

Regards,

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







Quote Reply
Re: Last Link in cgi? In reply to
No elliot i mean if i decided to upload a page to my site called...... myfavoritethings.shtml

i cant put <%lastlink%>

i want to be able to call it via ssi!

so anypage that i UPLOAD in shtml i can call it

not only genrated pages
Quote Reply
Re: Last Link in cgi? In reply to
Welp...Now, I understand what you are looking for...The codes would have to be hacked in the nph-build.cgi to create a file.

I don't have time to do it...but as a model you can look at the Site of the Day Mod and combine the LastLink with it to create a separate file, then use SSI calls to include the file.

Another suggetion would be to create another file via nph-build.cgi and copy the lastlink codes in a sub-routine that creates this new file.

Which would be easier to do? The latter option.

Regards,

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







Quote Reply
Re: Last Link in cgi? In reply to
Okay but i would prefer that it has nuthing to do with the actual nph-build.cgi

So that it just access the links db
so it is a seperate file called lastlink.cgi

that does this

open database file

get last 5 results

print results (using template.html)

close database


unfortuanately my knowledge in perl does not allow me to do this for myself.


Please help!!!

Bobsie?

Widgetz?

Thanks
Quote Reply
Re: Last Link in cgi? In reply to
Uh...It would have to use the nph-build.cgi to create a separate file that contains the lastlinks. Then you can use SSI to call this text file!!!!!!!

How else do you suppose to do this without using the nph-build.cgi file? Create a duplicate cgi script that contains everything you need in the nph-build.cgi script?? Now that would be double data entry.

Regards,

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








Quote Reply
Re: Last Link in cgi? In reply to
Okay well the bottom line is that i still need these codes so that i can call lastlink via ssi

so elliot if you have the time?
or if anyone else
it will be much obliged1!

Thanks

Gian
Quote Reply
Re: Last Link in cgi? In reply to
Have you attempted the modification that Eliot described? It is a pretty easy modification, and you might learn something about Perl rather than having to rely on others to provide completed codes for you... Wink

------------------
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 January 27, 2000).]
Quote Reply
Re: Last Link in cgi? In reply to
Okay well here is my attempt

and well i am still getting problems....it is a mixture of sotd.cgi and the lastlink codes

i called it lastlink.cgi

#!/usr/local/bin/perl
$txtfile = '/path/to/lastlink.txt';
# Required Librariers
# --------------------------------------------------------
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX /
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \
require "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";
$build_use_templates ?
require "$db_lib_path/site_html_templates.pl" :
require "$db_lib_path/site_html.pl";
};
if ($@) {
print "Content-type: text/plain\n\n";
print "Error including libraries: $@\n";
print "Make sure they exist, permissions are set properly, and paths are set correctly.";
exit;
}
# ========================================================
eval { &main; }; # Trap any fatal errors so the program hopefully
if ($@) { &cgierr("fatal error: $@"); } # never produces that nasty 500 server error page.
exit; # There are only two exit calls in the script, here and in in &cgierr.
sub main {
# --------------------------------------------------------
my $LASTX = 9;
open (DB, "<$db_file_name") or &cgierr("unable to open database:$db_file_name.\nReason: $!");
my @lines = <DB>;
close DB;
for ($i=$#lines; $i>=$#lines - $LASTX; $i--) {
chomp $lines[$i];
@tmp = &split_decode ($lines[$i]);
%tmp = &array_to_hash (0, @tmp);
open (LSLN, ">$txtfile") or &cgierr ("Can't Open FILE: $txtfile. Reason: $!");
print LSLN &site_html_link (%rec);
close LSLN;
$ENV{'REQUEST_METHOD'} and print "Content-type: text/plain\n\n";
print "Lastlinks are ready\n";
}


any reason why it is erroring out?

[This message has been edited by Gian (edited January 29, 2000).]
Quote Reply
Re: Last Link in cgi? In reply to
What errors are you receiving? Helps us to help you.

Regards,

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








Quote Reply
Re: Last Link in cgi? In reply to
A nice first effort... try changing
Code:
print LSLN &site_html_link (%rec);
to
Code:
print LSLN &site_html_link (%tmp);
That's the only problem I could see, but I haven't tried it...

------------------
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)
Quote Reply
Re: Last Link in cgi? In reply to
Thanks oldmoney!!

Well i tried the solution you gave me...and still no luck....
I looked through my error log and all i am getting is premature end of script headers?!!

Does this shed any light?

Thanks

Gian
Quote Reply
Re: Last Link in cgi? In reply to
Is the file being created?? The original SOTD script had similar problems when you execute the file via your browser.

Regards,

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








Quote Reply
Re: Last Link in cgi? In reply to
Nope no luck
It doesnt even create the file!

Regards

Gian
Quote Reply
Re: Last Link in cgi? In reply to
OK, a couple of obvious questions...
1) are you correctly putting the full path to your .txt file (this is not a URL)?
2) are you uploading the lastlink.cgi as ASCII, and is it CHMOD to 755?
2) have you tried creating the .txt file manually, CHMOD to 666, and running the script?

------------------
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)
Quote Reply
Re: Last Link in cgi? In reply to
Well

1 Yes
2 Yes
3 No.....tried it...and it still didnt work...


Could it be that i dont have a modification for site_html as sotd.cgi does?

Regards

Gian
Quote Reply
Re: Last Link in cgi? In reply to
You need to have a sub-routine in the site_html.pl file like the SOTD.

Also, are you using the EXACT codes you posted in this forum. If so, you need to change /path/to/ to the ABSOLUTE path to your lastlink.txt file.

Regards,

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








Quote Reply
Re: Last Link in cgi? In reply to
--------------------------------------------------------------------------------
Okay i added these codes...like the sotd.cgi. And it is still not working
Any ideas?

Gian
Quote Reply
Re: Last Link in cgi? In reply to
I would change the following:

Code:
print LSLN &site_html_link (%rec);

to the following:

Code:
print LSLN &site_html_lastlink (%rec);

Then you will have to create a separate sub-routine than the sub site_html_link in the site_html.pl.

BTW: What codes have you used in the site_html.pl?

Regards,

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








Quote Reply
Re: Last Link in cgi? In reply to
I used the sotd codes in site_html.pl

is that wrong?
or do they have to be a lastlink version?

Gian
Quote Reply
Re: Last Link in cgi? In reply to
They have to be unique to the fields that you want to appear for the lastlinks!

Regards,

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








Quote Reply
Re: Last Link in cgi? In reply to
Ohh.....well now i am confused
so i am writing a subroutine for lastlink to go in site_html.pl
Quote Reply
Re: Last Link in cgi? In reply to
ANd how exactly do the (%tmp) and (%rec) differ from each other?

Thanks

Gian
> >