Gossamer Forum
Home : Products : Links 2.0 : Customization :

Where to find?

(Page 2 of 3)
> > > >
Quote Reply
Re: Where to find? In reply to
How do you on the portal_link.html get this text:

12-May-2001
Welcome, stone! You have saved 3 links. Displaying 1 through 3.

into a table centred on the page

It shows outside any tables I have

Please advise

Stone

Quote Reply
Re: Where to find? In reply to
Simple matter of using appropriate HTML codes. I would suggest picking up HTML for Dummies or reviewing some online HTML tutorials.

Or for the lazy solution, you could use a WYSIWYG editor, like Front Page or Dreamweaver to customize the templates. Of course, bearing in mind that you need to preserve placement of the Links 2.0 tags:

EXAMPLE:

Code:

<%if links%>
<%links%>
<%endif%>


Regards,

Eliot Lee
Quote Reply
Re: Where to find? In reply to
Well the problem is that as far as I can see the

text doesn`t get called from the portal_link.html page

this is all there is on the page:<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<p> </p>
<table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><ul>
<li><font face="arial size="2"><a class="link" href="<%db_cgi_url%>/jump.cgi?ID=<%ID%>" target="_blank">
<%Title%>
</a></font>



<%if Description%>
<font face="arial size="2">

<%Description%>


</font>
<%endif%>

<font 2="2" size="1" face="Verdana, Arial, Helvetica, sans-serif">(Added:
<%Date%>
) <a href="<%db_cgi_url%>/rate.cgi?ID=<%ID%>">[Rate It]</a></font> <a href="<%db_cgi_url%>/portal.cgi?action=add&ID=<%ID%>"><font face="Verdana, Arial, Helvetica, sans-serif" size="1">[Add
to favorites]</font></a> <a href="<%db_cgi_url%>/portal.cgi?action=delete&ID=<%ID%>"><font face="Verdana, Arial, Helvetica, sans-serif" size="1">[Remove
favorites]</font></a> <a href="http://www.dkflight.dk/flightlink/cgi-bin/portal.cgi?action=login"><font face="Verdana, Arial, Helvetica, sans-serif" size="1">[login]</font></a>
</ul></td>
</tr>
</table>





</body>
</html>

So I think it gets printed from the cgi file.

Am I wrong

Please adwise

Stone



Quote Reply
Suggestion... In reply to
Drew and all,

You might want to consider not using jump.cgi link in the PORTAL Links, as this is a really easy chance for LINK OWNERS to "bookmark" or save their link and then continually click on it. Yes, there are codes in jump.cgi to reduce abusive "clicking" of links.

But I have found that linking jump.cgi is a really easy way for LINK OWNERS to put their links in the Cool pages.

Regards,

Eliot Lee
Quote Reply
Re: Where to find? In reply to
Hi junco Yes thats what i wanted to do. Place the bookmarks om my main page.I read the script (as much as i understand)but if im not mistaking ( im using templates) all the variables are read from Site_html_templates.pl so if i wanna use the variables(tags) like <%user%> ect that are ment to work with portal links then i have to add them as a variable to site_html_templates.pl ... also the code you suplied has to be added some way into the site_html_template..
( im a beginner with perl) but am i right about this? Or can i use a other solution for calling a variable... from portal.cgi


regards alfred



regards
alfred
Quote Reply
Re: Where to find? In reply to
Hmmm is it possible to add a 'send saved links to email' sub-mod for portal?

Quote Reply
Re: Where to find? In reply to
Which version? The codes would be similar, but here's for 2.0 (untested).

Change:
Code:
if (param('action') eq 'add') { &add(); }
elsif (param('action') eq 'delete') { &delete(); }
else { &home(); }
To:
Code:
if (param('action') eq 'add') { &add(); }
elsif (param('action') eq 'delete') { &delete(); }
elsif (param('action') eq 'send') { &send(); }
else { &home(); }
Then add:
Code:
sub send {
my ($data, @links);
open (FAV, "$db_lib_path/data/portal/$user{'ID'}.db") or die ("Could not open file $user{'ID'}. $!");
$data = <FAV>;
chomp $data;
close (FAV);
if ($data) {
my @saved = split /\|/, $data;
open (DB, "$db_lib_path/data/links.db") or die ("Could not open file links.db. $!");
while (<DB>) {
chomp(my $line = $_);
foreach my $id (@saved) {
/^$id\|/ or next;
my @rec = split /\|/, $line;
push @links, [ @rec ];
}
}
close (DB);
}
my $links;
if ($#links > -1) {
foreach (@links) {
my %rec = array_to_hash(0, @{$_});
$links .= &load_template('portal_link_mail.html', { %rec, %globals });
}
} else { $links .= 'You have not saved any favorites.'; }
my $msg = qq|
Hello, $user{'Login'}! Below is listing of all your saved links:

$links

To view your favorite links online, visit:
$db_cgi_url/portal.cgi
|;
require "$db_lib_path/Mailer.pm";
my $mailer = new Mailer ({
'smtp' => $db_smtp_server,
'sendmail' => $db_mail_path,
'from' => $db_admin_email,
'subject' => 'Your saved links',
'to' => $user{'Email'},
'msg' => $msg,
'log' => ''
}) or return;
$mailer->send or return;
print header();
print &load_template('portal_mail.html', { %globals, %user });
}
Create a link template called 'portal_link_mail.html' to be used to the email. should be text-based.

Create a new template called 'portal_mail.html' to be used to confirm the email was sent.

--Drew
Free, hot camel soup for Links hackers...
http://www.camelsoup.com
Quote Reply
Re: Where to find? In reply to
You are very good! Can wait to try it out...

Meanwhile... i been surfing many sites using links and I found lots of people using a mod that subsitutes the ratings with images.

Where is it available? I found some rating breakdowns that is graph like images. The images I want to use is stars.

If u are telling me that I can use the stars images to replace the graph, then should I use ratings breakdown 1 or 2 found in glennu's homepage?

Many thanks!!!


Quote Reply
Re: Where to find? In reply to
Errr forgot to ans ur qn... I want to use that emailing stuff for portal v1.0. Is the code the same?

Quote Reply
Re: Where to find? In reply to
'Where is it available? '

Search the forum there's atleast a couple of posts outlining instructions for this.

Glenn

Links 2 Mods Site:
http://cgi-resource.co.uk/pages/links2mods.shtml
Quote Reply
Re: Where to find? In reply to
over 80% of the code would be the same, but you need to use a form to get the user's email address and have a hidden field called 'action' with a value of 'send'.

I suggest you go ahead and use the test version of 1.0 since it's almost the 'exact' same code as 2.0, and it's easier for me to make changes and adapt it quicker for both versions.

Code:
sub send {
my ($email, @links, $links, $msg, $mailer);
$email = param('email');
$email =~ /^.+\@.+\..+$/ or &error('invalid looking email address');
if ($old) {
my @saved = split /\|/, $old;
open (DB, "$db_lib_path/data/links.db") or &error("Could not open file links.db. $!");
while (<DB>) {
chomp(my $line = $_);
foreach my $id (@saved) {
$line =~ /^$id\|/ or next;
my @rec = split /\|/, $line;
push @links, [ @rec ];
}
}
close (DB);
}
if ($#links > -1) {
foreach (@links) {
my %rec = array_to_hash(0, @{$_});
$links .= &load_template('portal_link_mail.html', { %rec, %globals });
}
} else { $links .= 'You have not saved any favorites.'; }
$msg = qq|Below is listing of all your saved links:\n|;
$msg .= qq|\n$links\n|;
$msg .= qq|To view your favorite links online, visit:\n|;
$msg .= qq|$db_cgi_url/portal.cgi|;
require "$db_lib_path/Mailer.pm";
$mailer = new Mailer ({
'smtp' => $db_smtp_server,
'sendmail' => $db_mail_path,
'from' => $db_admin_email,
'subject' => 'Your saved links',
'to' => $email,
'msg' => $msg,
'log' => ''
}) or return;
$mailer->send or return;
print header();
print &load_template('portal_mail.html', { %globals });
}
Note, I've updated the other post as well, because I noticed a few syntax errors.

--Drew
Free, hot camel soup for Links hackers...
http://www.camelsoup.com
Quote Reply
Re: Where to find? In reply to
[reference to the above code, for portal v1.0]

Couldn't run ur code at first but after noticing some mistakes...

left out>>> my $in = shift;
inserted>>> $email = $in->param('email');
inserted>>> print $in->header();

the cgi files managed to be executed but the email dat was send to me says... "You have not saved and favorites"...

I think it could be something to do wif this part

In Reply To:
if ($#links > -1) {
foreach (@links) {
my %rec = array_to_hash(0, @{$_});
$links .= &load_template('portal_link_mail.html', { %rec, %globals }); } }
else { $links .= 'You have not saved any favorites.'; }
pls help and thanks in advance...




Quote Reply
Re: Where to find? In reply to
Didn't I say to use the test version of 1.0?

To use this with the original 1.0, yes you need to have that OO crap in since that's the way it was written. Aditionally, you'll need to add this:
Code:
my $old = cookie($name);
and change this:
Code:
my @saved = split /\|/, $old;
To:
Code:
my @saved = split /x/, $old;
--Drew
Free, hot camel soup for Links hackers...
http://www.camelsoup.com
Quote Reply
Re: Where to find? In reply to
hi junco

i already asked you the bookmark sidebar question. But
a few questions more here
Where do i put the code you gave?
I already tryed it in portal.cgi and in site_html_templates.pl but that doesn't work...
And if i put the code inside a file ??? What would be the tag(s) to put in the main index(the template home.html)

The portal mod is working fine the way it was ment by the way.

Regards
alfred




regards
alfred
Quote Reply
Re: Where to find? In reply to
Hi junko! I did wat u said and it worked! Thanks!!! U are brillant... Smile

I stumbled on something, on the page that says your email has been sent, if i keep refreshing the page... and clicked on 'retry' for the prompt... the email will be sent to the address another time. Is there any way to prevent the email from being send again?

Thanks...

Quote Reply
Re: Where to find? In reply to
You could save a timestamp to a cookie called 'time' using time(). On each load the page, get the cookie with cookie('time'), and subtract value from the current time and see if it's less than the number of seconds in a day, and redirect to an error page if it is.

(or you could do the same thing as a database... but this is a bit quicker to code)

--Drew
Free, hot camel soup for Links hackers...
http://www.camelsoup.com
Quote Reply
Re: Where to find? In reply to
errr i dun think i able to code dat though it may be easy to u...

but i think this extra mod could be very useful. some ppl tends to click twice for submit buttons... with this mod can prevent extra msging...

Quote Reply
Re: Where to find? In reply to
Where I do not type in any email address or type in a fake email address with @... it directs me to a internal server error page. May I know which part went wrong?

This code is for sending email from portal's saved links.

In Reply To:
sub send {
my $in = shift;
my $old = $in->cookie($name);
my ($email, @links, $links, $msg, $mailer);
$email = $in->param('email');
($email =~ /^.+\@.+\..+$/) or print &error("Invalid looking email address");
if ($old) {
my @saved = split /x/, $old;
open (DB, "$db_lib_path/data/links.db") or &error("Could not open file links.db. $!");
while (<DB>) {
chomp(my $line = $_);
foreach my $id (@saved) {
$line =~ /^$id\|/ or next;
my @rec = split /\|/, $line;
push @links, [ @rec ];
}
}
close (DB);
}
if ($#links > -1) {
foreach (@links) {
my %rec = array_to_hash(0, @{$_});
$links .= &load_template('fav_mail_link.txt', { %rec, %globals });
}
} else { $links = qq|<span style="font-size: 12">You have not saved any favorites.</span>|; }
$msg = qq|Below is listing of all your saved links:\n|;
$msg .= qq|\n$links\n|;
$msg .= qq|To view your favorite links online, visit:\n|;
$msg .= qq|http://www.lazyjuice.com/searchsg|;
require "$db_lib_path/Mailer.pm";
$mailer = new Mailer ({
'smtp' => $db_smtp_server,
'sendmail' => $db_mail_path,
'from' => $db_admin_email,
'subject' => 'Your saved links',
'to' => $email,
'msg' => $msg,
'log' => ''
}) or return;
$mailer->send or return;
print $in->header();
print &load_template('fav_mail_success.html', { %globals });
}

Quote Reply
Re: Where to find? In reply to
You changed something you shouldn't have...
Code:
($email =~ /^.+\@.+\..+$/) or print &error("Invalid looking email address");
If you look in the code I provided there is no print statement before &error...

--Drew
Free, hot camel soup for Links hackers...
http://www.camelsoup.com
Quote Reply
Re: Where to find? In reply to
sorrie never see it is w/o the 'print'

but still... doesn''t work.

when i never type any address and click submit - it brings to internal server error

when i type a fake address, without @ and submit, it brings me to success page.

I will get an email when i entered a proper address.

*confused*

Quote Reply
Re: Where to find? In reply to
Make sure you have this subroutine:
Code:
sub error {
my $message = shift;
print header();
print &load_template ('portal_error.html', {
'message' => $message,
%globals
});
exit;
}
and make sure you have a template called 'portal_error.html' with the 'message' tag in it.

--Drew
Free, hot camel soup for Links hackers...
http://www.camelsoup.com
Quote Reply
Re: Where to find? In reply to
Hmmm i got an error at line 246

the print header() part

pls help me seee my script... http://www.lazyjuice.com/downloads/portal.txt

thanks...

Quote Reply
Re: Where to find? In reply to
Try changing this:
Code:
sub error {
my $message = shift;
print header();
print &load_template ('fav_error.html', {
'message' => $message,
%globals
});
exit;
}

....to....

Code:
sub error {
my $message = shift;
print $in->header();
print &load_template ('fav_error.html', {
'message' => $message,
%globals
});
exit;
}
Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/

Quote Reply
Re: Where to find? In reply to
I really wish you upgraded to one other 3 newer versions... any of them:
PortalLinks 1.0 (cookies)
    version: 2.0 posted 13-May-01
PortalLinks 2.0 (flatfile)
    version: 1.01 posted 01-May-01
PortalLinks 3.0 (mySQL)
    version: 1.0 posted 18-May-01

Now.. if you insist on using old code, couple things you need to fix:
1) you did not completely comment out the old subroutine
2) change
Code:
my ($message) = shift;
print header();
to:
Code:
my ($message, $in) = @_;
print $in->header();
3) change any instance like:
Code:
$message = "error message";
print $in->header();
print &error;
or
Code:
&error("error message");
to something like:
Code:
&error("error message.", $in);
--Drew
Free, hot camel soup for Links hackers...
http://www.camelsoup.com
Quote Reply
Re: Where to find? In reply to
Thanks. The code is working... :)

> > > >