Gossamer Forum
Home : Products : Links 2.0 : Customization :

Indea for new links on then main page !

Quote Reply
Indea for new links on then main page !
Hi,
Im was trying to think of a way to have the new links for the day displayed on the main page.
I managed to do that through SSI . where i managed to get links to creat an additional page for the new links but with a different template so it would be the one included in the main page .

its working , and i still have the original new links pages with their own template.

but this means i will have two pages generated for each day , while i can do with one becasue i dont need the rest after the nest update.
detailes of what i did :

in site_html_templates.pl :
under sub site_html_new

i added a new sub :
sub site_html_new2 {
# --------------------------------------------------------
# This routine will build a what's new page.

return &load_template ('new2.html', {
total => $total,
grand_total => $grand_total,
link_results => $link_results,
title_linked => $title_linked,
%globals
} );
}

in : nph-build.pl
in : sub build_new_pag
under :
# Crete the new page, and do a bit of HTML work for the main page.
if ($build_span_pages) {
open (NEW, ">$build_new_path/$date$build_extension") or cgierr ("unable to open what's new page: $build_new_path/$build_index. Reason: $!");
$use_html ?
print qq|\tNew Links for <a href="$build_new_url/$date$build_extension" TARGET="_blank">$date</a>: $total\n| :
print qq|\tNew Links for $date: $total\n|;
print NEW &site_html_new;
close NEW;

i added :

open (NEW2, ">$build_new_path/$date.html") or cgierr ("unable to open what's new page: $build_new_path/$build_index. Reason: $!");
$use_html ?
print qq|\tNew2 Links for <a href="$build_new_url/$date$build_extension" TARGET="_blank">$date</a>: $total\n| :
print qq|\tNew2 Links for $date: $total\n|;
print NEW2 &site_html_new2;
close NEW2;

so now i have a new page called &date.html (all my other extensions are .shtml)

this page can be called from the man page by usinmg :
<!--#include virtual="/bookshop/new/<%date%>.html"-->

and then just creat a new template , call it new2.html


i know there must be an easier way to do it .
what i nned to do now , is have only one page created for the new links of the day , using the new2.html template,
in order to save space.

even better would be to have them placed in the main page by nph-build.pl


if anyone knows a better solution, please tell me .

Thank you ,
Quote Reply
Re: Indea for new links on then main page ! In reply to
have you looked at gotze's lastlink...

it's similiar.. a few twitches and your there.. otherwise i suggest doing something a little different..

uhh... in nph-build.cgi sub build_stats

above

Code:
open (DB, "<$db_file_name") or &cgierr("unable to open database: $db_file_name. Reason: $!");

put:

Code:
my $date = &get_date;

and then above

Code:
push (@{$new_links{$category}}, @values) if ($values[$db_isnew] eq "Yes");

you would put something along the lines of

Code:
push (@new_today, @values) if ($values[$db_isnew] eq "Yes" && $values[$db_modified] eq $date);

now whereever inside of nph-build.cgi you want it to go.. ie: build_home_page..

you will need to find the "appropriate (not in the middle of a loop!" place to put this..

Code:
@new_today = &build_sorthit (@new_today);
for ($i = 0; $i < int($#new_today/$#db_cols); $i++) {
%tmp = &array_to_hash ($i, @new_today);
$new_today .= &site_html_link{%tmp};
}

which pretty much puts them in the scalar $new_today alphabetical.. and then in the site_html_templates place.. (in the appropriate subroutine..)

add

Code:
new_today => $new_today,

to the list of variables.. which will make <%new_today%> the code.

jerry
Quote Reply
Re: Indea for new links on then main page ! In reply to
Thanks , i will try it ans see where i reach . i just have to get some sleep so i can think .

heres what im trying to do :
http://209.102.88.17/bookshop

Thanks again,