I want to add a link 'Send Message' in the links.html template. When the link 'Send Message' is clicked a Form - sendmess.html shows. This form has the following fields - Name, Email, Address & Message etc. The receipient field is <%Contact Email%>. The form will be submitted using Matt's Formmail.pl script. What modifications need to be done to get the value of <%Contact Email%> in sendmess.html page/template.
Jan 14, 2004, 12:57 PM
User (118 posts)
Jan 14, 2004, 12:57 PM
Post #2 of 11
Views: 6850
Nice Idea. I would love to do that as well. Anybody there to help us both ?
>> Nakul Goyal (SEO, Link Building Expert)
Web Site Promotion
Tips 'n' Tricks
SEO News
>> Nakul Goyal (SEO, Link Building Expert)
Web Site Promotion
Tips 'n' Tricks
SEO News
Jan 14, 2004, 10:53 PM
Enthusiast (854 posts)
Jan 14, 2004, 10:53 PM
Post #3 of 11
Views: 6834
I would highly recommend against using Matt's Formmail.pl script. Links has its own mail processor anyway (Mailer.pm). Have a look at nph-email.cgi to see how to send emails. as far as getting data into a template, you can do something like:
BEGIN {
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1");
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1");
require "links.cfg";
require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";
require "$db_lib_path/Mailer.pm";
};
}
eval { &main; };
$@ and &cgierr("Fatal error: $@");
exit;
sub main {
my (%in) = &parse_form();
my (%rec) = &get_record($in{"ID"});
if (! defined $rec{"ID"}) {
&cgierr("record " . $in{"ID"} . " not found");
}
my $output = &load_template("sendmess.html", { %rec, %globals });
print "Content-type: text/html\n\n";
print $output;
}
note that this is untested...
Philip
------------------
Limecat is not pleased.
Code:
#!/usr/local/bin/perl BEGIN {
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1");
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1");
require "links.cfg";
require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";
require "$db_lib_path/Mailer.pm";
};
}
eval { &main; };
$@ and &cgierr("Fatal error: $@");
exit;
sub main {
my (%in) = &parse_form();
my (%rec) = &get_record($in{"ID"});
if (! defined $rec{"ID"}) {
&cgierr("record " . $in{"ID"} . " not found");
}
my $output = &load_template("sendmess.html", { %rec, %globals });
print "Content-type: text/html\n\n";
print $output;
}
note that this is untested...
Philip
------------------
Limecat is not pleased.
Jan 23, 2004, 11:26 PM
Veteran (1352 posts)
Jan 23, 2004, 11:26 PM
Post #8 of 11
Views: 6800
Well, to make a new template, you will need to define a subroutine in site_html_templates for it, and you will need this in the sendmess.pl file, under the require statements:
$build_use_templates ?
require "$db_lib_path/site_html_templates.pl" :
require "$db_lib_path/site_html.pl";
The new sub would be along the lines of...
sub sendmess {
# --------------------------------------------------------
# This routine will build a send message page.
return &load_template ('sendmess.html', {
total => $total,
grand_total => $grand_total,
link_results => $link_results,
title_linked => $title_linked,
%globals
} );
}
Of course, you also need to have a sendmess.html file in the template directory.
Seems to me, anyway...
Leonard
aka PerlFlunkie
$build_use_templates ?
require "$db_lib_path/site_html_templates.pl" :
require "$db_lib_path/site_html.pl";
The new sub would be along the lines of...
sub sendmess {
# --------------------------------------------------------
# This routine will build a send message page.
return &load_template ('sendmess.html', {
total => $total,
grand_total => $grand_total,
link_results => $link_results,
title_linked => $title_linked,
%globals
} );
}
Of course, you also need to have a sendmess.html file in the template directory.
Seems to me, anyway...
Leonard
aka PerlFlunkie
Last edited by:
PerlFlunkie: Jan 23, 2004, 11:28 PM
Mar 30, 2004, 3:17 AM
User (104 posts)
Mar 30, 2004, 3:17 AM
Post #10 of 11
Views: 6690
There is mod for link 2.0 which is used to contact the link owner through website which is very useful and can be used to send messages
Megrisoft
Web Hosting Company
India Software Company
SEO Company