Gossamer Forum
Home : Products : Links 2.0 : Customization :

creata the homepage twice....

Quote Reply
creata the homepage twice....
Is it pssible to make nph-build create the homepage twice, in my case for example:
in http://surfootball.com/index.shtml
and http://surfootball.com/english/index.shtml

THEULS

------------------
----------------------
Surfootball.ovh.org
----------------------
Quote Reply
Re: creata the homepage twice.... In reply to
Yes...it is.

Do the following (which are adapted from the ROOT Build/Category Build FAQ/Tutorial located at www.anthrotech.com/cgi/links/faqs/rootbuild/ ):

1) Add the following variable in your links.cfg file:

Code:
$build_second_root_path = "/absolute/path/to/english";
$build_second_root_url = "http://surfootball.com/english";

2) Add the following sub-routine in your db_utils.pl file:

Code:
sub build_sec_dir {
# --------------------------------------------------------
# Verifies that all necessary directories to build category pages.
my $input = shift;
my ($dir, $path) = '';
my @dirs = split /\//, $input;

foreach $dir (@dirs) {
$path .= "/$dir";
&build_check_dir ($build_second_root_path, $path);
if (! (-e "$build_second_root_path$path")) {
print "\tMaking Directory ($build_dir_per): '$build_second_root_path$path' ...";
if (mkdir ("$build_second_root_path$path", "$build_dir_per")) {;
print "Made. CHMOD ($build_dir_per) ...";
if (chmod ($build_dir_per, "$build_second_root_path$path")) {;
print "Done.";
}
else { print "CHMOD ($build_dir_per) failed! Reason: $!."; }
}
else { print "mkdir failed! Reason: $!."; }
print "\n";
}
}
return "$build_second_root_path$path";
}


3) Then add the following codes in your sub build_staggered routine in the nph-build.cgi file:

Code:
$t1 = time();
print "** Creating Second Home Page . . .\n";
&build_second_home_page;
print "** Done (", time - $t1, " s)!\n\n";

AFTER the following codes:

Code:
$t1 = time();
print "** Creating Home Page . . .\n";
&build_home_page;
print "** Done (", time - $t1, " s)!\n\n";

4) Then add the following codes in your sub build_all routine in the nph-build.cgi file:

Code:
# Create Second Home Page
$use_html ?
print qq|Building <A HREF="$build_second_root_url/$build_index">Second Home Page</A> . . .\n| :
print qq|Building Second Home Page . . .\n|;
&build_second_home_page;
print "\tDone\n\n";

AFTER the following codes:

Code:
# Create Home Page
$use_html ?
print qq|Building <A HREF="$build_root_url/$build_index">Home Pages</A> . . .\n| :
print qq|Building Home Page . . .\n|;
&build_home_page;
print "\tDone\n\n";

4) Then add the following sub-routine after the sub build_home_page routine:

Code:
sub build_second_home_page {
# --------------------------------------------------------
my ($subcat, @rootcat);
local ($total);

# Check to see which categories are off of the root.
foreach $subcat (sort keys %category) {
if ($subcat =~ m,^([^/]*)$,) {
push (@rootcat, $subcat);
}
}
print "\tSubcategories: "; print $#rootcat+1; print "\n";
print "\tTotal Links: $grand_total\n";
print "\tOpening page: $build_second_root_path/$build_index\n";
open (HOME, ">$build_second_root_path/$build_index") or &cgierr ("unable to open second home page: $build_second_root_path/$build_index. Reason: $!");
$category = &site_html_print_cat (@rootcat) if ($#rootcat >= 0);
$total = $grand_total;
print HOME &site_html_second_home;
close HOME;
print "\tClosing page.\n";
}

5) Create the following sub-routine in your site_html_templates.pl file:

Code:
sub site_html_second_home {
# --------------------------------------------------------
# This routine will build a home page. It is not meant to have any
# links on it, only subcategories.

return &load_template ('second_home.html', {
category => $category,

grand_total => $grand_total,
%globals
});
}

6) Create a new template file called second_home.html file. This should be a copy of your home.html with the same tags that you use in that template file.

7) Create a global tag called build_second_root_url in the %globals section of your site_html_templates.pl file:

Code:
build_second_root_url => $build_second_root_url

8) Then in your home.html file, add the following link:

Code:
<a href="<%build_second_root_url%>">English Page</a>

NOW...if you want a secondary level of category pages...I would suggest using the codes found in the above mentioned FAQ/Tutorial that I linked. The code hack I have just provided will only create a second home page NOT a second set of category pages.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.




[This message has been edited by AnthroRules (edited May 08, 2000).]
Quote Reply
Re: creata the homepage twice.... In reply to
I didn't try it, but gonna soon...
THANX A LOT,
Smile Smile Smile Smile Smile Smile

THEULS

------------------
----------------------
Surfootball.ovh.org
----------------------
Quote Reply
Re: creata the homepage twice.... In reply to
You're welcome.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: creata the homepage twice.... In reply to
There is a FAQ about having different category layouts in the Resource Center. If you can't figure out how to adapt the codes in the FAQ to the codes I provided you, then ask for clarification.

But you should be able to figure it out!!

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: creata the homepage twice.... In reply to
This was exactly what I was looking for and works a treat -

One remaining issue:

The second homepage- how can can I alter the display of the catagories - what i want to do specifically is remove the split into two columns sub

1) 1st homepage- two columns of cats
2) second_homepage single column

Any help
Quote Reply
Re: creata the homepage twice.... In reply to
Glad you figured it out...Don't forget to refer to README files....

Wink

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: creata the homepage twice.... In reply to
Eliot- apologies for asking simple questions- however I am still getting to grips with the internals of links

Status: 2 homepages are being built using 2 seperate templates- however the new sub for building cat2 are not being enforced after build

nphbuild
Quote:
sub build_second_home_page {
# --------------------------------------------------------
my ($subcat, @rootcat);
local ($total);

# Check to see which categories are off of the root.
foreach $subcat (sort keys %category) {
if ($subcat =~ m,^([^/]*)$,) {
push (@rootcat, $subcat);
}
}
print "\tSubcategories: "; print $#rootcat+1; print "\n";
print "\tTotal Links: $grand_total\n";
print "\tOpening page: $build_second_root_path/$build_index\n";
open (HOME, ">$build_second_root_path/$build_index") or &cgierr ("unable to open second home page: $build_second_root_path/$build_index. Reason: $!");
$category = &site_html_print_ssi (@rootcat) if ($#rootcat >= 0);
$total = $grand_total;
print HOME &site_html_second_home;
close HOME;
print "\tClosing page.\n";
}

I am attempting to call &site_html_print_ssi as my building sub

site_html_templates

Quote:
sub site_html_print_ssi {
# --------------------------------------------------------
# This routine determines how the list of categories will look.
# We now use a table to split the category name up into two columns.
# For each category you can use the following variables:
#
# $url : The URL to go to that category
# $category_name : The category name with _ and / removed.
# $category_descriptions{$subcat}: The category description (if any).
# $numlinks : The number of links inside that category (and subcategories).
# $mod : The newest link inside of that category.
#

my (@subcat) = @_;
my ($url, $numlinks, $mod, $subcat, $category_name, $description, $output, $i);
my ($half) = int (($#subcat+1) / 1);

# Print Header.
$output = qq|<div align="center"><table width="90%" border="0" cellspacing="4" cellpadding="0"><tr><td class="catlist" valign="top">\n|;

foreach $subcat (sort @subcat) {
($description) = @{$category{$subcat}}[2];

# First let's get the name, number of links, and last modified date...
$url = "$build_root_url/" . &urlencode($subcat) . "/";
if ($subcat =~ m,.*/([^/]+)$,) { $category_name = &build_clean($1); } else { $category_name = &build_clean($subcat); }
$numlinks = $stats{"$subcat"}[0];
$mod = $stats{"$subcat"}[1];

# We check to see if we are half way through, if so we stop this table cell
# and begin a new one (this lets us have category names in two columns).
if ($i == $half) {
$output .= qq|</td><td class="catlist" valign="top">\n|;
}
$i++;

# Then we print out the name linked, new if it's new, and popular if its popular.
$output .= qq|<dl><dt><strong><a href="$url"><font face="Verdana" size="2">$category_name</font></a></strong> <small class="numlinks">($numlinks)</small> |;
$output .= qq|<small><sup class="new">new</sup></small>| if (&days_old($mod) < $db_new_cutoff);
$output .= qq|</dt>|;
$output .= qq|<dd><font face="Verdana" size="3">$description</font></dd>| if (!($description =~ /^[\s\n]*$/));
$output .= qq|</dl>|;
}

# Don't forget to end the unordered list..
$output .= "</td></tr></table></div>\n";
return $output;

-The difference in sub site_html_print_ssi is that I am trying to build a single column of cats not two

can you help?

TIA
Quote Reply
Re: creata the homepage twice.... In reply to
Gahhh

got it- i had to change links.cfg to 777 for dir perms Frown

Apologies for the last post
Quote Reply
Re: creata the homepage twice.... In reply to
How do you make links 2.0 build the category pages twice?

I followed how to make a home page twice and the post above
hints around to creating category pages by researching the
FAQ in the resource center.

I have added a new template and it seems to build but when
I go to the url it supposed to build at I find that it did not build at all.

I am tring to create a text version in a new directory called /text/

I think the Resource center Faq explains how to add just a new
template but I am tring to build all the category pages using the template text_category.html

Has someone done this before? I could use some help.

Quote Reply
Re: creata the homepage twice.... In reply to
Will the text version include the New, Cool, and Rated pages and search, newsletter, and rate scripts? If so, it could be a lot easier to make a complete copies of nph-build.cgi, site_html_templates.pl, and your templates (under different names). Make sure your second nph-build.cgi script points to the right site_html_templates.pl script and that you put the correct template names in the subroutines.

--Drew
Quote Reply
Re: creata the homepage twice.... In reply to
This is excatly what I want.

so I copy nph_build.cgi and rename it text_nph_build.cgi
ant the same with site_html_templates.pl to text_site_html_templates.pl

I guess my next question is where do I start changing code
to point to my new modifications.

I have already changed the paths to point to the correct templates. I just don't know how to implement the new
text_nph_build.cgi and the new text_site_html_templates.pl

Quote Reply
Re: creata the homepage twice.... In reply to
I think I figured it out but I still need some help.

I did what junko said (the message above)
I changed nph-build.cgi to text_nph-build.cgi
but when I call it directly I get a 500 error.

http://www.referralmaker.com/...n/text_nph-build.cgi

but when I call it by telnet I get this..

Code:
!panda:~$ /home/referralmaker/www/free/admin/text_nph-build.cgi
Building Pages
Pages built on 16-Sep-2000 at 19:20:47
--------------------------------------------------------

Backing up database . . .
Backup exists for today.. Skipping
Done.

Building URL Index . . .
Done.

Updating New and Popular Records . . .
What's New Cutoff: 14 days
Popular Cutoff: 2 hits
Updating record: 28, marking as new.
Updating record: 29, marking as new.
Done.

Updating ratings ..
Done.

Loading Category Information . . .
Done.

Gathering Category and Link information . . .
Done

Building Home Page . . .
Subcategories: 35
Total Links: 3
Opening page: /home/referralmaker/www/text/index.html
Closing page.
Done

Building What's New Page . . .
New Links for 10-Sep-2000: 1
New Links for 8-Sep-2000: 1
Total New Links: 2
Done

Building What's Cool Page . . .
Cool Links: 0
Done

Building Top Rated . . .
Vote Range: ..
Rate Range: ..
Done

Building Category Pages . . .
Building Category: Almost_Free
Subcategories: 0

Done

Pages Built (1 s)!panda:~$
and actually makes the links in the text.

I am not sure why I get a 500 error in my browser
I had to modify 3 files from the orginal I was wondering
if someone could look at these for errors because I am lost
why it does not work in browser but works in telnet.

http://www.referralmaker.com/...n/text_links.cfg.txt

http://www.referralmaker.com/...n/text_nph-build.txt

http://www.referralmaker.com/...e_html_templates.txt

Thanks in advance

Quote Reply
Re: creata the homepage twice.... In reply to
I am not sure, but try renaming text_nph-build.cgi to nph-text-build.cgi. "nph-" is, I seem to recall, a special extension (non-parsing headers, or something)

John


Quote Reply
Re: creata the homepage twice.... In reply to
Thanks, gotze

It worked like a charm I renamed it from text_nph-build.cgi
to nph-text_build.cgi.

Thanks.



Quote Reply
Re: creata the homepage twice.... In reply to
Cool