Gossamer Forum
Home : Products : Links 2.0 : Customization :

Pass two variables to a sub in site_html_templates?

Quote Reply
Pass two variables to a sub in site_html_templates?
For example, I would like to move the variable new/updated mod by Bobsie to its own sub (rather than repeat the code in site_html_link, site_html_detailed, etc), and need to pass $rec{'DateAdded'} and $rec{'Date'}. Any ideas?
Quote Reply
Re: Pass two variables to a sub in site_html_templates? In reply to
Did you try creating a sub-routine called sub new_stuff and then calling that sub-routine by &new_stuff; in those other sub-routines?

Regards,

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


Quote Reply
Re: Pass two variables to a sub in site_html_templates? In reply to
Eliot,

I was considering (but haven't implemented yet)... in site_html_lnik, or whatever...
Code:
new_mod_img => &get_new_image ($rec{'DateAdded'},$rec{'Date'}),
and then a sub...
Code:
sub get_new_image {
my ($date, $update) = @_;
my ($new_mod_img);

$days_old = &days_old($date);
if ($days_old <= 2) { $new_mod_img = qq|<img src="/img/icon/new1.gif" border="0" width=24 height=12 alt="New in the last 48 hours" align="absmiddle">|; }
elsif ($days_old <= 7) { $new_mod_img = qq|<img src="/img/icon/new2.gif" border="0" width=24 height=12 alt="New in the last week" align="absmiddle">|; }
elsif ($days_old <= $db_new_cutoff) { $new_mod_img = $new_7 = qq|<img src="/img/icon/new3.gif" border="0" width=24 height=12 alt="New in the last 2 weeks" align="absmiddle">|; }

if (($new_mod_img eq "") && (&compare_dates($date, $update))) {
$days_old = &days_old($date);
if ($days_old <= $db_new_cutoff) { $new_mod_img = qq|<img src="/img/icon/update.gif" border="0" width=24 height=12 alt="Updated" align="absmiddle">|; }
}
return $new_mod_img;
}



[This message has been edited by oldmoney (edited January 03, 2000).]