Gossamer Forum
Home : Products : Links 2.0 : Customization :

Small Tiny Add-on for MY Links!

(Page 1 of 2)
> >
Quote Reply
Small Tiny Add-on for MY Links!
I have added a small tiny add-on to the MY Links script, which is a help page within the script.

To see this in action, go to:

anthrotech.com/cgibin/wwwvl/mylinks.cgi?help=1

Here is what you need to do:

1) Add the following codes:

Code:
elsif ($in->param('help')) { &help ($in); }

AFTER

Code:
elsif ($in->param('delete')) { &delete ($in); }

in the sub main routine.

2) Add the following sub-routine to the mylinks.cgi script:

Code:
sub help {
#---------------------------------------------------------
# Help Menu for people to set their Cookies.

my $in = shift;
print $in->header();
&site_html_my_help;
return;
}

3) Add the following sub-routine to your site_html_templates.pl file:

Code:
sub site_html_my_help {
# --------------------------------------------------------
# This routine shows the layout of the MY Link Home Page

my $tags = shift;
print &load_template ('my_help.html', {
%$tags,
%globals
});
}

4) Create a template named my_help.html.

If you want to use my template file, feel free. It is located at the following URL:

www.anthrotech.com/cgibin/wwwvl/templates/my_help.html

5) Add a link in your my_home.html file that goes to the Help Page, like the following:

Code:
<a href="http://www.mydomain.com/cgi-bin/links/mylinks.cgi?help=1">Help Page</a>

(For those that couldn't figure it out from the example I gave how to link to the Help Page.)

Hope this is helpful.

Regards.

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------




[This message has been edited by Eliot (edited December 18, 1999).]

[This message has been edited by Eliot (edited December 18, 1999).]

[This message has been edited by Eliot (edited December 18, 1999).]

[This message has been edited by Eliot (edited December 18, 1999).]
Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
Cool, I needed that. Now, does anyone have any idea how to get a news headlines script to run inside the main MyLinks page?
Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
Do you have these news headlines running in other parts of your LINKS site? If so, all you need to do is define the tags as you have done for your other template files and add them into the MY Links template files.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
Well, the only suggestion I have is to take the codes you have for the News stuff and create a sub-routine in site_html_templates.pl called news. Then create a global variable called news with the following codes:

Code:
news => &news,

Then in your template files, including mylinks template files, add the following tag:

Code:
<%news%>

That is the only thing I can suggest.

BTW: It might be a good idea to buy a Perl or CGI manual/book and learn about these programming languages, so that you can more easily customize cgi/perl scripts.

Wink

Regards.

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
(I'm inching my way through cgi101.com)

I think I know figured out how to do it, but let me know if I'm wrong.

in site_html_templates.pl add:

getheadlines => &getheadlines

to %globals

and then add:

sub getheadlines { my $headlines = `/home/lycghost/cgi-bin/news/getheadlines.cgi`;
$headlines =~ s,Content-type:\stext/html,,;
return $headlines;
}



[This message has been edited by lordmouse (edited December 18, 1999).]
Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
Way to go, Elliot!

------------------
Will
Webmaster
FishHoo! Search index for Fishermen
www.fishhoo.com
Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
Thanks, willdeb.

Regards.

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
(edited out that junk)

Now, to get it to run I use an ssi call in a normal SHTML page, with <!--#exec cgi="/home/lycghost/public_html/cgi-bin/"-->. Please give me further instructions on how to run this from MyLinks.

Thank you,
Philip

[This message has been edited by lordmouse (edited December 18, 1999).]
Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
I would recommend looking at the WebAdverts codes and see what you can do about making your news scripts work like WebAdverts. Then create a global variable that can be placed on all template filee, including the MY Links template file.

Regards.



------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
You should add a \ before &getheadlines, like the following:

Code:
getheadlines => \&getheadlines

Then add the tag:

Code:
<%getheadlines%>

Regards.

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
Thank you. Smile

maybe this is a dumb question, but why is "\" required in this case, and not for any of the other instances of &whatever in %globals?
Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
It has something to do with the SSI codes that are used in that particular sub-routine. Sorry, this is the most laymen explanation I can think of.

Update:....

I have added another sub-routine in the mylinks.cgi script that checks the users browser and reports back if their browser is Cookie enabled....

Here is what you do:

1) Add the following codes:

Code:
elsif ($in->param('test')) { &test ($in); }

AFTER the following codes:

Code:
elsif ($in->param('delete')) { &delete ($in); }
'

in your mylinks.cgi script.

2) Add the following sub-routine to your mylinks.cgi script:

Code:
sub test {
#---------------------------------------------------------
# Help Menu for people to set their Cookies.

my $in = shift;
print $in->header();
&site_html_my_test;
return;
}

3) Add the following sub-routine to your site_html_templates.pl file:

Code:
sub site_html_my_test {
# --------------------------------------------------------
# This routine shows the layout of the MY Link Home Page

my $tags = shift;
print &load_template ('my_test.html', {
%$tags,
%globals
});
}

4) Create a template file called my_test.html.

Feel free to use my my_test.html template file:

www.anthrotech.com/cgibin/wwwvl/templates/my_test.html

5) Add the following link to your my_home.html file:

Code:
<a href="http://www.mydomain.com/cgi-bin/links/mylinks.cgi?test=1">Test Page</a>

Example:

www.anthrotech.com/cgibin/wwwvl/mylinks.cgi?test=1

Hope this helps.

Regards.

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
Elliot,

When I clicked on your Example URL, it told me the correct browser but said my browser didn't support cookies or they were disabled. That is not the case. IE 5.01 with cookies enabled.

Should the example have determined my cookies corectly?

We have to get a life away from these machines.



------------------
Will
Webmaster
FishHoo! Search index for Fishermen
www.fishhoo.com
Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
Hmm...It should work...I tested it on five browsers this afternoon. I will probably be re-writing the codes in cgi rather than javascript.

Regards.

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
is there any difference just making a help.html??

jerry
Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
Not really, Widgetz.

But I thought it would be cool to have pages contained in the same script.

Regards.

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
but it takes bandwidth.. Smile

jerry
Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
Eliot,

The MyLinks test page only works if the MyLinks cookie has already been set. I found a way to test for cookies without setting one beforehand, but it only works with MSIE

replace:

if (document.cookie.length>0)

with

if (navigator.cookieEnabled == true)

You could also cut out if statement and just add

document.write("<b>Cookies Enabled?:</b> ",navigator.cookieEnabled,"<BR>");

under

document.write("<b>Version:</b> ",navigator.appVersion,"<BR>");

[This message has been edited by lordmouse (edited December 23, 1999).]
Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
alot of places just set a cookie to see if cookies work.. ie:

Set-Cookie: name=cookie; value=1;

then you just do..

if ($in->cookie('cookie')) { print "Cookies Enabled"; }
else { print "Cookies Disabled"; }

you could do that for Mylinks and not allow them to use it unless they have cookies..

jerry
Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
how much space does the cookies take on my hard drive? how can i delete all the cookies
(mylinks and other sites)?
Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
Hi, lordmouse

What news script are you running?

I'm looking for one.

Thanks.

------------------
ARMYNAVY.COM
MilitarySurplus Ring







Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
Widgetz,

That would make sense, but what I meant is that if the user hasn't already tried to add a bookmark, that JavaScript would be spitting out false information. Anyway, where do I stick that little piece of code you just gave us?

TrainedMonkey,

http://www.lifelinenews.net

There are 3 or 4 different versions you can use.

[This message has been edited by lordmouse (edited December 24, 1999).]
Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
to delete your cookies..

in your browser.. disable it.. from preferences. then restart the browser.. and all the cookies should be gone.. but it's really annoying without cookies.. alot of things don't work..

news script?? what are you talking about? on my site? i made that myself.. it's not much now.. but i plan on doing more things to it later on.. it's obviously Links SQL and it happens to be statis (NOT SSI) that is pasted on there just like anything else on that page through Links SQL type code..

lordmouse.. all i can say is that if you want to use that code.. you have to first set the cookie with the script then redirect to the script so it can read the cookie.. perl doesn't allow you to read the cookie set in the same instance.. unlike javascript..

you could do it in a weird way though.. but it's too stupid Smile

jerry
Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
lordmouse,

The cookie test works JUST FINE in Netscape. I am assuming you are still experiencing problems using domain.com versus www.domain.com.

Wink

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Small Tiny Add-on for MY Links! In reply to
maybe it does work just fine for you. I have Netscape 4.5 and MSIE 5.01 and neither worked with the code you provided. Oh well, it doesn't really matter. A user should be able to tell if they have cookies enabled if their links show up.

[This message has been edited by lordmouse (edited December 28, 1999).]
> >