Gossamer Forum
Quote Reply
Alex...
Can you do me a favor please?
Can you recode the nph-build.cgi build_cool_page section so that it splits up the whats cool links onto multiple pages like the search results and category listings? Based on the $LINKS{build_links_per_page}
Right now, it builds them on one huge page Frown
Could you make the next/prev page look like it is on the search results:
1 2 3 4 5 >>

Chris
Quote Reply
Re: Alex... In reply to
Hi Chris,

I'll take a look at how difficult it is..

Cheers,

Alex
Quote Reply
Re: Alex... In reply to
Code:
sub build_span_pages {
my ($page, $totalpages) = @_;
my ($prev_page, $next_page, $output);

return qq~ ~ if ($totalpages == 1);
$prev_page = $page-1;
$next_page = $page+1;
if ($page > 1) {
$output .= qq~<a href="$url~;
$output .= qq~&page=$prev_page~ if ($prev_page > 1);
$output .= qq~"><b>< Previous</b></a> <a href="$url">1</a> ~;
if ($prev_page > 1) {
for (2 .. $prev_page) { $output .= qq~<a href="$url&page=$_">$_</a> ~; }
}
}
else { $output .= qq~< Previous ~; }
$output .= qq~<b>$page</b> ~;
if ($page < $totalpages) {
for ($next_page .. $totalpages) { $output .= qq~<a href="$url&page=$_">$_</a> ~; }
$output .= qq~<a href="$url&page=$next_page"><b>Next ></b></a>~;
}
else { $output .= qq~Next >~; }
return $output;
}

just a little something I used with links 2.0

you just send in like

Code:
$OUT{span} = &build_span_pages($page, $totalpages);

it works with just about any script i've used that has span pages..

course you'd have to replace $url with appropriate stuff.

jerry

[This message has been edited by widgetz (edited November 01, 1999).]
Quote Reply
Re: Alex... In reply to
this is what i added to my templates.. i removed the next and prev tags from templates + nph-build.cgi

Code:
sub site_html_span_pages {
my ($page, $totalpages, $url) = @_;
my ($prev_page, $next_page, $output);

$prev_page = $page-1;
$next_page = $page+1;
if ($page > 1) {
$output .= qq~<a href="$url/~;
($prev_page > 1) ?
($output .= qq~more$prev_page$LINKS{build_extension}~) :
($output .= $LINKS{build_index});
$output .= qq~"><b>< Previous</b></a> <a href="$url/$LINKS{build_index}">1</a> ~;
if ($prev_page > 1) {
for (2 .. $prev_page) { $output .= qq~<a href="$url/more$_$LINKS{build_extension}">$_</a> ~; }
}
}
else { $output .= qq~< Previous ~; }

$output .= qq~<b>$page</b> ~;

if ($page < $totalpages) {
for ($next_page .. $totalpages) { $output .= qq~<a href="$url/more$_$LINKS{build_extension}">$_</a> ~; }
$output .= qq~<a href="$url/more$next_page$LINKS{build_extension}"><b>Next ></b></a>~;
}
else { $output .= qq~Next >~; }
return $output;
}

Code:
$OUT{span} = &site_html_span_pages (1, $OUT{totalpages}, $url);

Code:
$OUT{span} = &site_html_span_pages ($page_num, $OUT{totalpages}, $url);

Code:
$OUT{totalpages} = int($numlinks/$LINKS{build_links_per_page});
($OUT{totalpages} < $numlinks/$LINKS{build_links_per_page}) and $OUT{totalpages}++;

jerry

[This message has been edited by widgetz (edited November 01, 1999).]
Quote Reply
Re: Alex... In reply to
Umm...you guys lost me here.
I only want to change "sub build_cool_page"
so that it splits up the links on multiple pages according to $LINKS{build_links_per_page} = 10;
if $LINKS{build_span_pages} = 1;

Right now it puts all the links on one page.
I only have it set for 50 cool links and it builds a 170k page, but if I set it for 5%, then it builds a 1mb page Frown

Chris
Quote Reply
Re: Alex... In reply to
Alex, what do I need to do to get this to work this way?
This is the only thing holding us up from going live.
Quote Reply
Re: Alex... In reply to
i can only think up how to do this without listing it in category results.. it'd take alot more to get it to list with category results and link results.. of course.. THAT IS WHAT SEARCH.CGI does..

jerry
Quote Reply
Re: Alex... In reply to
Hello!

A rescue solution would be... Wink

# Get all the cool links.

...

$sth = $LINKDB->prepare (qq!
...

ORDER BY Name Asc
LIMIT 10

You can setup any limit you want and it will do it.

Hope this helps, (to go online, looking forward to see your website Smile)












[This message has been edited by rajani (edited November 05, 1999).]