Gossamer Forum
Home : Products : Links 2.0 : Customization :

categories list on sub pages

Quote Reply
categories list on sub pages
hope you can help..
I was trying to get subcategories to appear as a permanent side-menu -

for some reason the menu link urls are there but the actual text for the link doesn't show up- so its invisible effectively...here's the full sub menu routine...


sub menu {
# --------------------------------------------------------
#
my (%c, @fields);
open (DB, "<$db_category_name") or &cgierr("unable to open $db_file_name. Reason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB>) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
@fields = &split_decode ($_);
$c{$fields[$db_main_category]}++;
}
close DB;
foreach $field (sort keys %c) {
unless ($field =~ m,^([^/]*)$,) {
$field2 = &build_clean($1);
$category_list .= qq|<a href= "$build_root_url/$field">$field2</a>
|;
}
}
return $category_list;
}

Quote Reply
Re: categories list on sub pages In reply to
No need to post duplicate Posts in the forums...add replies to your original Threads, please.

The $1 variable looks to be undefined.



Regards,

Eliot Lee
Quote Reply
Re: categories list on sub pages In reply to
I changed that to ($field) but I get the category name in the link too - i.e. category_subcat
I'm trying to just get the subcategory name in the menu...
is it possible?

hope you can help...


Quote Reply
Re: categories list on sub pages In reply to
anyone been able to have a look at this problem?


Quote Reply
Re: categories list on sub pages In reply to
Try changing:


unless ($field =~ m,^([^/]*)$,) {

To:

unless ($field =~ m,.*/([^/]+)$,) {

Glenn

Links 2 Mods Site:
http://cgi-resource.co.uk/pages/links2mods.shtml
Quote Reply
Re: categories list on sub pages In reply to
unfortunately that just printrs the main categories - I am trying to get the sub-categories only. And rather than 'category_subcategory'
printing on the page, i just wanted 'subcategory '

hope you can help....


Quote Reply
Re: categories list on sub pages In reply to
Change this:

$field2 = &build_clean($1);
$category_list .= qq|<a href= "$build_root_url/$field">$field2</a>

to....

$field2 = &build_clean($1);
$field2 =~ /^.+\_/;
$category_list .= qq|<a href= "$build_root_url/$field">$field2</a>


That MAY work or MAY not.

Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/

Quote Reply
Re: categories list on sub pages In reply to
no, unfortunately that just produces odd, absolute path style links

Quote Reply
Re: categories list on sub pages In reply to
would i be better to just add static links to the category template to do this?

Quote Reply
Re: categories list on sub pages In reply to
No cause if you change your categories you'll need to alter all the static links.

This will work, replace:

unless ($field =~ m,^([^/]*)$,) {

With:

unless ($field =~ m?/([^"]+)?) {




Glenn

Links 2 Mods Site:
http://cgi-resource.co.uk/pages/links2mods.shtml
Quote Reply
Re: categories list on sub pages In reply to
it still seems to print absolute path details - although it does also print the url's to the sub-categories, the titles of them are all the same, and not what they are called

here is the full sub menu -

sub menu {
# --------------------------------------------------------
#
my (%c, @fields);
open (DB, "<$db_category_name") or &cgierr("unable to open $db_file_name. Reason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB>) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
@fields = &split_decode ($_);
$c{$fields[$db_main_category]}++;
}
close DB;
foreach $field (sort keys %c) {
unless ($field =~ m?/([^"]+)?) {
$field2 = &build_clean($1);
$field2 =~ /^.+\_/;
$category_list .= qq|<a href= "$build_root_url/$field">$field2</a>|;
}
}
return $category_list;
}

Quote Reply
Re: categories list on sub pages In reply to
has anyone got this to work - I wouldn't have thought a sub-cat submenu was too tricky....