Gossamer Forum
Home : Products : Links 2.0 : Customization :

Subcategories on main index page?

Quote Reply
Subcategories on main index page?
How do I get sub categories on my main index.html page, like at yahoosuck.com?

------------------
--The Current Average Teacher:Student Ratio is 1:30! We Can Take 'Em--
Quote Reply
Re: Subcategories on main index page? In reply to
Did you ever get a reply to this - I would like to know as well.



------------------
New Zealand Christian Internet Directory
Quote Reply
Re: Subcategories on main index page? In reply to
This has been documented many times, so looking through the archive for more info would be benificial.

The quick answer is, there is not automatic way to do it. you need to include the html in the main category description field.

--mark

------------------
You can reach my by ICQ at UID# 8602162

Quote Reply
Re: Subcategories on main index page? In reply to
I've already done this nice feature for my Language Links v1.0alpha.
you can see an example at www.ford-network.at

downloading the source is possible at www.ford-network.at/l-mod2.zip

but don't install my files exactly, i've done too much modifications, so you don't wanna know how to get it running. but you could take a look how i've done.

also:release 3 would be available next time. including password-protect modify, sitemap, searchlog, expirator, and much much more.

cu

------------------
www.ford-network.at



Quote Reply
Re: Subcategories on main index page? In reply to
I don't think ther's a need to edit .cgi files. It can be done with HTML:
lets say you got a /People/ sub on your http://www.int0r.net host
it looks like: http://www.int0r.net/People/
and there's another sub /Friends/ under /People/ that looks like: http://www.int0r.net/People/Friends/
and couple of others:
http://www.int0r.net/People/Best_Friends/
http://www.int0r.net/People/So-so_Friends/
http://www.int0r.net/People/Girlfriends/
What you want to do is, in ###HOME PAGE#### section in you site_html.pl delte "$category" and add this:
===============
<p>
<h2><a href="/People/">People</a></h2><br>
<a href="/Friends/">Friends</a>, <a href="/Best_Friends/">Best Friends</a>, <a href="/So-so_Friends/">So-so Friends</a>, <a href="/Girlfriends/">Girlfriends</a> ...<br>
</p>
===============
This will give you a category "People" with couple of others under "People"... well you got the idea. It will look like in Yahoo.com Smile

Pasha

------------------

-[ It's just another night; good morning Webmasters! ]-
Quote Reply
Re: Subcategories on main index page? In reply to
i don't like to put the HTML-code in the description!! this sub will do this for you!! with als subcats - and not only on the mainpage!!

maybe you've to change some of the code - cause i use a specail catindex.db i've build before, instead you can use your category.db

sub get_subcats {
# ---------------
# figures out if a category have subcats and if, give them back as links

my $my_path = shift;
my (@subcats, @subcats_path, $output);

$delim = quotemeta($db_delim);
$number = 0;

open (REAL, "<$db_category_index") or &cgierr("unable to open database: $db_category_index. Reason: $!");
LINE: while (<REAL> ) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
if (/.+$delim($my_path.+)$delim(.+)/) {
if ($1 ne /$my_path\/.+\/.+/) {
chomp $1;
chomp $2;
($1 eq /^\s*$/) and next LINE;
$subcats_path{$number} = $1;
$subcats{$number} = $2;
$number++;
}
}
next LINE;
}
close REAL;
if ($number) {
for ($i=0; $i <= ($number-1); $i++) {
$output .= "<a class=\"";
if ($quickbar eq "quickbar") {$output .= "qudescript";}
else {$output .="descript";}
$output .= "\" href=\"$build_root_url/$subcats_path{$i}\">$subcats{$i}</A>, ";
}
}
chop $output;
chop $output;
return $output;
}

then in site_html.pl add this line after
# First let's get the name, number of links, and last modified date...
$description_subcats = &get_subcats($my_path);

and instead of $category_descriptions{$subcat} use $description_subcats at the place of the description

hope you'll get this to run...
next time Language Links v1.0 alpha release 3 comes out - with much, much, much useful mods and a sort-funktion for this subcats.

cu

------------------
www.ford-network.at



Quote Reply
Re: Subcategories on main index page? In reply to
Where do I add that sub and does it limit the number of sub-cats it lists on the front page, say to three? Thanks.

------------------
The RelayMan
simsearch.hyperart.net
mdhealyjr@adelphia.net
Quote Reply
Re: Subcategories on main index page? In reply to
I'm sorry, UBB has deleted my message (looks like so, cause I've already posted the answers an another useful sub for this mod)

but at the moment i haven't enough time to write again. only: this sub displays all - and not only 3 subcategories and not only on the mainpage, also on all category pages.

cu next time,....
you can download my whole LanguageLinks 1b1 from www.ford-network.at/LanguageLinks1b1.zip


------------------
www.ford-network.at



Quote Reply
Re: Subcategories on main index page? In reply to
Hi Bogus, hi all,

I really would like to integrate this little mod from bogus.
Unfortunally I'm no perl guru and I really have no idea how this lines of code work he extracts the subcat names and paths out of the category db.
As he uses a special file here I can not figure out, how to change the code to get the same result out of the category.db file of links 2.0.
Any help would be nice!

------------------
Jodowein
Quote Reply
Re: Subcategories on main index page? In reply to
OK, under this line:

# Rebuild URL Index (This file is auto-generated, you will never need to touch it!

add this to your nph-build.cgi
# Rebuild CATEGORY Index (This file is auto-generated, you will never need to touch it!
print "Building CATEGORY Index . . .\n";
&build_category_index;
print "Done.\n\n";

and then after sub build_url_index add this:
sub build_category_index {
# --------------------------------------------------------
# This routine builds a quick Catgory lookup database to look for the real names.
# so the script does not have to search the category.db for every search of the real_name

my @values = ();

open (DB, "<$db_category_name") or &cgierr("unable to open database: $db_category_name.\nReason: $!");
open (REAL, ">$db_category_index") or &cgierr("unable to open category index: $db_category_index. Reason: $!");
if ($db_use_flock) { flock (REAL, 2) or &cgierr ("unable to get exclusive lock. Reason: $!"); }
LINE: while (<DB> ) {
/^#/ and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp; # Remove trailing new line.
@values = &split_decode($_);

@catnamelist = split (/\//, $values[1]);
$category_name = pop @catnamelist;
$category_name = &build_clean ($category_name);
print REAL "$values[0]$db_delim$values[1]$db_delim$category_name\n";
}
close DB;
close REAL;
}

don't forget to set the path in your links.cfg for $db_category_index. may be /yourhost.com/links/admin/data/category.db

cause it's better to build a quick category lookup database. now it should work! :-)

cu


------------------
Language Links v 1b1
www.ford-network.at


[This message has been edited by Bogus (edited February 14, 1999).]

[This message has been edited by Bogus (edited February 17, 1999).]
Quote Reply
Re: Subcategories on main index page? In reply to
Hi bogus,

thx alot!

Now it was only one more little change to finally get rid of those "cat : subcat1, cat : subcat2" outputs and generate simply "subcat1, subcat2" under each cat.



------------------
Jodowein
Quote Reply
Re: Subcategories on main index page? In reply to
Sorry, I've forgot that 'build_clean' adds the : an the cat. I would think about it.

cu
Quote Reply
Re: Subcategories on main index page? In reply to
The easiest way to do it is to just put the HTML in the description field. This is how most people accomplish it. So put:

<a href="/links/Cat/Subcat1">SubCat1</a> ..
<a href="/links/Cat/Subcat2">SubCat2</a> ..
<a href="/links/Cat/Subcat3">SubCat3</a>

as the description for category Cat and you'll get the three linked subcategories.

Cheers,

Alex
Quote Reply
Re: Subcategories on main index page? In reply to
I've done the changes above to the code of
sub build_category_index
after the line-break

i haven't tested it, but i think it would work!!!

TO ALEX: I know this is the simplest way to do. But not for me and (i think) much of other users. Cause when my page is ready I'll have more than 1500 categories. and for this mine would work much better.

Also i'll loose a field for the categorie if i'll doing it your way. Could add a new, but with every new field the db grows up.

cu

------------------
www.ford-network.at





[This message has been edited by Bogus (edited February 17, 1999).]