I have modified another mod, it may do what you want. I have not tested this code, but it should work. Post any problems, we'll figure 'em out.
Start with the editor's pick mod, here:
http://gossamer-threads.com/...flat&post=140567 In
site_html_templates.pl, you can leave off the part where you add
sub site_html_pick. You can also skip creating the new template.
Do only the first two steps shown in the mod code below where it says
### Edit nph-build.cgi Now quite using the code from that mod, and use the code here.
Use this next sub instead of the one from the mod, and put it in
db_utils.pl instead of nph-build.cgi:
## Modto put top Editor's Pick insert on any page, called by <%eds_pix%>
sub pick_page {
# --------------------------------------------------------
# Creates an "Editor's Pick" page.
local ($total, $pick_results, $title_linked);
my (%link_output, $category_clean);
$total = 0;
CATEGORY: foreach $category (sort keys %pick_links) {
LINK: for ($i = 0; $i < ($#{$pick_links{$category}}+1) / ($#db_cols + 1); $i++) {
$total++;
%tmp = &array_to_hash ($i, @{$pick_links{$category}});
$link_output{$category} .= &site_html_link (%tmp) . "\n";
}
}
foreach $category (sort keys %pick_links) {
$category_clean = &build_clean ($category);
$pick_results .= qq|<P><A HREF="$build_root_url/$category/$build_index">$category_clean</A>\n|;
$pick_results .= $link_output{$category};
}
return $pick_results;
}
sub eds_pix{
# --------------------------------------------------------
# creates the editors pick insert
$eds_pix= &site_html_eds_pix;
return $eds_pix;
}
## end mod
For template users, add this in
site_html_templates.pl:
sub site_html_eds_pix{
# --------------------------------------------------------
# This routine will build a topx insert.
return &load_template ('eds_pix.html', {
pick_page => &pick_page,
%rec,
%globals
} );
}
In the same file, you will need to add this to the globals at the top of the file:
%globals = (
date => &get_date,
time => &get_time,
db_cgi_url => $db_cgi_url,
build_root_url => $build_root_url,
site_title => $build_site_title,
css => $build_css_url,
eds_pix => &eds_pix, banner => ''
);
Next create a template in the
template directory. Name it
eds_pix.html; you can code it however you want, and the Editor's Picks are called in it by <%pick_results%>. Example (note that this is not a full html page, just code to format the insert):
<div id="nav">
<h3>Editor's Picks</h3>
<p class="cat-like">
<%pick_results%>
</p>
</div>
Now just put the main tag wherever you want the Editor's Picks to appear. It looks like this:
<%eds_pix%>.
For non-template users, try this in
site_html.pl (change the html to suit your site):
##########################################################
## Editor's Picks Insert ##
##########################################################
sub site_html_eds_pix{
$output = qq~
<div id="nav">
<h3>Editor's Picks</h3>
<p class="cat-like">
$pick_results
</p>
</div>
~;
return $output;
}
Leonard
aka PerlFlunkie