Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

parsing $rec

Quote Reply
parsing $rec
I've been trying to pass $link into the nph-build.cgi subroutines but I always get an argument

Software error:
Can't use an undefined value as a HASH reference at Links/HTML_Templates.pm line 403.

or

Software error:
HTML_TEMPLATES: Argument '' must be hash reference at /home/hostglo/public_html/cgi-bin/hosts/admin/nph-build.cgi line 1204

I thought that $link was a hash ref

while ($link = $sth->fetchrow_hashref) {
$total++;
$link_output{$link->{'Name'}} .= &site_html_link_article ($link);

$cat_path = $link->{'Category'};
$ID = $link->{'ID'};

# Write out individual articles.

$title_linked = &build_linked_title ('Article >> $link->Category');
$article = "Indiv";

open (ARTICLE, ">$LINKS{build_article_path}/$cat_path/$ID.shtml") or die ("unable to open Featured page: $LINKS{build_article_path}/$cat_path/$ID.shtml. Reason: $!");
print "\tIndividual Articles: <a href='$LINKS{build_article_url}/$cat_path/$ID.shtml' target='_blank'> $ID </a>\n";
print ARTICLE &site_html_article ($link, {grand_total => $GRAND_TOTAL, total => $total, link_results => $link_results, title_linked => $title_linked, article => $article});
close ARTICLE;

} # end of while


How can you parse the $link hash into your templates like you can do in detailed or link.html?
Quote Reply
Re: parsing $rec In reply to
which subroutine are you talking about.. please post the site_html_(_____) sub..

jerry
Quote Reply
Re: parsing $rec In reply to
This is a new site_html_template sub that I am making to build article pages from my article database.

It is basically like the other sub site_html_cool but I want to be able to parse the fields of the article database which are fields like name, title, article etc.

Here is the sub

sub site_html_article {
# -------------------------------------------# This routine to build individual articles

# my ($rec, $tags, $dynamic) = @_;
# my $template = defined $dynamic ? $dynamic->param('t') : undef;
# (ref $rec eq 'HASH') or croak "HTML_TEMPLATES: Argument '$rec' must be hash reference";
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 ('article.html', {
%$tags,
# %$rec,
%GLOBALS
}, undef, $template );
defined $dynamic and &clean_output($dynamic, \$output);
return $output;
}

I want it to work like the sub site_html_detailed or sub site_html_link.

It just doesn't want to seem to work.

Thanks Jerry. You've excelled a lot in your programming skills through Links. I tried all weekend to convert my review script to Links SQL and have almost got it but things like it not recognizing simple commands drives me nuts.

I have an array @ratesort and if I wanted the first value, wouldn't I just use,

my $lowestrate = $ratesort[0];

For some reason it won't give me a number.

Anyways, I was telling my wife about your combination program because we forgot the combo, and we don't even know the last number.

Thanks for your time Jerry.

Kevin
Quote Reply
Re: parsing $rec In reply to
is this line 403?

Code:
my $template = defined $dynamic ? $dynamic->param('t') : undef;

if it is.. change this line:

Code:
print ARTICLE &site_html_article ($link, {grand_total => $GRAND_TOTAL, total => $total, link_results => $link_results, title_linked => $title_linked, article => $article});

to

Code:
print ARTICLE &site_html_article ({grand_total => $GRAND_TOTAL, total => $total, link_results => $link_results, title_linked => $title_linked, article => $article, %$link });

also.. i'll get review.cgi out SOON.. i promise.. i have too much homework now that it's almost time for the holidays.. (all the teachers are giving us these projects due the day before we go on vacation)

hehe.. for the combo thing..

to figure out the last number.. see if the lock has a RED arrow pointing down on top or a thin red line..

if it's a red arrow.. the lock will "catch" 12 times.. 7 in between numbers.. 4 end with the same digit.. the last is the third number..

if it's a thin red line.. it will "catch" on the third number..

you didn't learn that from me Wink

jerry