Gossamer Forum
Home : Products : Gossamer Links : Pre Sales :

Links-SQL1.11 modifications into Links-SQL 2.0

Quote Reply
Links-SQL1.11 modifications into Links-SQL 2.0
Hello

The new version of links-SQL is very cool & complete template based

I have in my current 1.11 version some extra modifications, namely:

badlink.cgi

recommend_it.cgi

to install this options, some templates & modifications should be added in HTML_templates.pm

badlinks.cgi has in links-SQL 1.11 the following subroutine:

sub site_html_badlink_form {
# --------------------------------------------------------
# This routine is displayed if there was a problem subscribing.
#
my ($tags, $dynamic) = @_;
my $template = defined $dynamic ? $dynamic->param('t') : undef;
(ref $tags eq 'HASH') or croak "HTML_TEMPLATES: Argument '$tags' must be hash reference";

defined $dynamic and &load_user ($dynamic, $tags);
my $output = &load_template ('badlink.html', {
%$tags,
%GLOBALS
}, undef, $template);
defined $dynamic and &clean_output($dynamic, \$output);
print $output;
}

sub site_html_badlink_success {
# --------------------------------------------------------
# This routine is displayed if there was a problem subscribing.
#
my ($tags, $dynamic) = @_;
my $template = defined $dynamic ? $dynamic->param('t') : undef;
(ref $tags eq 'HASH') or croak "HTML_TEMPLATES: Argument '$tags' must be hash reference";

defined $dynamic and &load_user ($dynamic, $tags);
my $output = &load_template ('badlink_success.html', {
%$tags,
%GLOBALS
}, undef, $template);
defined $dynamic and &clean_output($dynamic, \$output);
print $output;
}

and recommend_it.cgi

has in links-SQL this subroutine

sub site_html_recommend {
# --------------------------------------------------------
# This routine determines how the recommend form page will look like.
#
my ($tags, $dynamic) = @_;
my $template = defined $dynamic ? $dynamic->param('t') : undef;
(ref $tags eq 'HASH') or croak "HTML_TEMPLATES: Argument '$tags' must be hash reference";

defined $dynamic and &load_user ($dynamic, $tags);
my $output = &load_template ('recommend.html', {
%$tags,
%GLOBALS
}, undef, $template);
defined $dynamic and &clean_output($dynamic, \$output);
print $output;
}

sub site_html_recc_success {
# --------------------------------------------------------
# This routine determines how the recommend succes page will look like.
#
my ($tags, $dynamic) = @_;
my $template = defined $dynamic ? $dynamic->param('t') : undef;
(ref $tags eq 'HASH') or croak "HTML_TEMPLATES: Argument '$tags' must be hash reference";

defined $dynamic and &load_user ($dynamic, $tags);
my $output = &load_template ('recc_success.html', {
%$tags,
%GLOBALS
}, undef, $template);
defined $dynamic and &clean_output($dynamic, \$output);
print $output;
}

Now my question is:
How can I add these subroutines in Links-SQL 2.0 Beta???

Do you have any ideas:

Quote Reply
Re: Links-SQL1.11 modifications into Links-SQL 2.0 In reply to
First, this should be asked in the Next Gen form (one flight up).

Second, it will take a bit of time to get familiar with the way the next version does things.

In short, you do not have to create a new routine for each display page. You pass in the page to display:

Links::SiteHTML::display ('template', {hash});

The template is the name of the template without the .html, which is in the default template directory. the {hash} is a reference to the values you want to pass in. Anything you passed into the program via $IN is automatically available (There are certain 'global' variables present now).

so...

Code:
sub site_html_badlink_form {
# --------------------------------------------------------
# This routine is displayed if there was a problem subscribing.
#
my ($tags, $dynamic) = @_;
my $template = defined $dynamic ? $dynamic->param('t') : undef;
(ref $tags eq 'HASH') or croak "HTML_TEMPLATES: Argument '$tags' must be hash reference";

defined $dynamic and &load_user ($dynamic, $tags);
my $output = &load_template ('badlink.html', {
%$tags,
%GLOBALS
}, undef, $template);
defined $dynamic and &clean_output($dynamic, \$output);
print $output;
}
Would most likely be able to be replaced by a call to:
$IN->header();
Links::SiteHTML::display ('badlink')


If everything you use is in the $IN array. If you look up a record, or do some database stuff, you'd want to pass that as the second parameter:

$IN->header();
Links::SiteHTML::display ('badlink', $rec)

Good luck!






PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://postcards.com/FAQ


Quote Reply
Re: Links-SQL1.11 modifications into Links-SQL 2.0 In reply to
Ok it seems to be very easy to add new subroutines with the new code, but in which script, and in whisch place should i add these options???
Normally I should think to add these in SiteHTML.pm but where in these scripts??

Quote Reply
Re: Links-SQL1.11 modifications into Links-SQL 2.0 In reply to
SiteHTML is for output only. In the new links it's been changed so you don't have to edit this file at all. Globals are in globals.txt and the SiteHTML.pm creates the output routines automatically. You just pass it a template.

In the scripts where you would call the output routine, in badlink.cgi you would just use the Link::SiteHTML::display ('template', {tags}) format.

PUGDOGŪ
PUGDOGŪ Enterprises, Inc.
FAQ: http://pugdog.com/FAQ