How do I get subcategories to appear on the main page? Just like Yahoo... Links only displays the main category by default. I know there is a way to mess with the code and get this done but I know little about coding.... Is there a place where I could copy the script or modification for this? Thank you.
How do I get subcategories to appear on the main page? Just like Yahoo... Links only displays the main category by default. I know there is a way to mess with the code and get this done but I know little about coding.... Is there a place where I could copy the script or modification for this? Thank you.
Jun 15, 1999, 7:44 AM
User (282 posts)
Jun 15, 1999, 7:44 AM
Post #2 of 34
Views: 8176
RP,
Please try searching for answers using the Search feature before asking questions. You'll find this has been answered many times.
Take a look at this: http://www.gossamer-threads.com/...um3/HTML/000793.html
Phoenix
Please try searching for answers using the Search feature before asking questions. You'll find this has been answered many times.
Take a look at this: http://www.gossamer-threads.com/...um3/HTML/000793.html
Phoenix
Jun 22, 1999, 5:18 PM
Veteran (2260 posts)
Jun 22, 1999, 5:18 PM
Post #4 of 34
Views: 8172
Hi...
If you want to build subcategories under the categories automatically, I made a MOD that you can use. Just follow these instructions, they are easy!
In sub site_html_print_cat find the line:
and replace it with:
$v = 0;
$output .= qq~<$font_small>~;
foreach $subcatsub (sort @{$subcategories{$subcat}}) {
$suburl = "$build_root_url/" . &urlencode($subcatsub) . "/";
if ($subcatsub =~ m,.*/([^/]+)$,) { $subcategory_name = &build_clean($1); } else { $subcategory_name = &build_clean($subcatsub); }
$output .= qq~<br>~ if ($description =~ /2$/ | | $v eq "0"); # CHANGE "| |" (NO SPACE)!!!
$output .= qq~&[nbsp];&[nbsp];~ if ($description =~ /2$/); # REMOVE "["s and "]" FROM THIS LINE!!!
$output .= qq~<a href="$suburl">$subcategory_name</a>~;
$output .= qq~, ~ if ($description =~ /1$/ && $v ne $#{$subcategories{$subcat}});
$v++;
}
$output .= qq~</font>~;
}
else {
$output .= qq~<dd><span class="descript">$description</span></dd>~ if (!($description =~ /^[\s\n]*$/));
}
!!! You will need to change the line with "| |" in it cause this message board splits them up. They should be stuck together (no space in between them)
AND
ON THE LINE WITH &[nbsp];&[nbsp]; change it so it doesn't have the "["s or the "]"s. The message board took them out. !!!
There are 2 styles that this will make.
If you want the style that looks like this:
Category
Subcategory1, Subcategory2, Subcategory3
Go to the category, you want to use, and edit it's description to: SUB1
OR
If you want the style that looks like this:
Category
Subcategory1
Subcategory2
Subcategory3
Go to the category, you want to use, and edit it's description to: SUB2
Then build the pages!
It lists all the subcategories, so you may not like it but I made it the way I wanted it, so I don't plan on changing it to limit only a certain number of letters or something.
Also, if you use the second style, it wouldn't look good if you had ALOT of subcategories in one category and not in another, cause one end will be longer than the other.
HOPE THAT HELPS!
Jerry
[This message has been edited by widgetz (edited June 23, 1999).]
[This message has been edited by widgetz (edited June 23, 1999).]
If you want to build subcategories under the categories automatically, I made a MOD that you can use. Just follow these instructions, they are easy!
In sub site_html_print_cat find the line:
Code:
$output .= qq~<dd><span class="descript">$description</span></dd>~ if (!($description =~ /^[\s\n]*$/));and replace it with:
Code:
if ($#{$subcategories{$subcat}} >= 0 && $description =~ /^SUB.*/) { $v = 0;
$output .= qq~<$font_small>~;
foreach $subcatsub (sort @{$subcategories{$subcat}}) {
$suburl = "$build_root_url/" . &urlencode($subcatsub) . "/";
if ($subcatsub =~ m,.*/([^/]+)$,) { $subcategory_name = &build_clean($1); } else { $subcategory_name = &build_clean($subcatsub); }
$output .= qq~<br>~ if ($description =~ /2$/ | | $v eq "0"); # CHANGE "| |" (NO SPACE)!!!
$output .= qq~&[nbsp];&[nbsp];~ if ($description =~ /2$/); # REMOVE "["s and "]" FROM THIS LINE!!!
$output .= qq~<a href="$suburl">$subcategory_name</a>~;
$output .= qq~, ~ if ($description =~ /1$/ && $v ne $#{$subcategories{$subcat}});
$v++;
}
$output .= qq~</font>~;
}
else {
$output .= qq~<dd><span class="descript">$description</span></dd>~ if (!($description =~ /^[\s\n]*$/));
}
!!! You will need to change the line with "| |" in it cause this message board splits them up. They should be stuck together (no space in between them)
AND
ON THE LINE WITH &[nbsp];&[nbsp]; change it so it doesn't have the "["s or the "]"s. The message board took them out. !!!
There are 2 styles that this will make.
If you want the style that looks like this:
Category
Subcategory1, Subcategory2, Subcategory3
Go to the category, you want to use, and edit it's description to: SUB1
OR
If you want the style that looks like this:
Category
Subcategory1
Subcategory2
Subcategory3
Go to the category, you want to use, and edit it's description to: SUB2
Then build the pages!
It lists all the subcategories, so you may not like it but I made it the way I wanted it, so I don't plan on changing it to limit only a certain number of letters or something.
Also, if you use the second style, it wouldn't look good if you had ALOT of subcategories in one category and not in another, cause one end will be longer than the other.
HOPE THAT HELPS!
Jerry
[This message has been edited by widgetz (edited June 23, 1999).]
[This message has been edited by widgetz (edited June 23, 1999).]
Jun 23, 1999, 4:18 AM
User (66 posts)
Jun 23, 1999, 4:18 AM
Post #5 of 34
Views: 8186
Hey, Nice job on that mod!
I know there has been many people looking for something like this. I set it up and it worked great. I do have a question, as I am not 100% comfortable with coding cgi. I am using your mod in sub site_html_print_cat, and was wondering how hard it would be to put the categories in a form list. Like this:
<FORM name = "form">
<SELECT NAME="site" SIZE=1 onChange ="formHandler(this.form)">
<OPTION VALUE="">--Select a Subcategory--
<OPTION VALUE="/links/subcat1/">subcat1
<OPTION VALUE="/links/subcat2/">subcat2
<OPTION VALUE="/links/subcat3/">subcat3
</SELECT></FORM>
Maybe this could be SUB3.
This would make my life immeasurably easier.
Thanks again for the nice mod.
Aaron
------------------
www.serve.com/garden/geosearcher
[This message has been edited by Aaron (edited June 23, 1999).]
I know there has been many people looking for something like this. I set it up and it worked great. I do have a question, as I am not 100% comfortable with coding cgi. I am using your mod in sub site_html_print_cat, and was wondering how hard it would be to put the categories in a form list. Like this:
<FORM name = "form">
<SELECT NAME="site" SIZE=1 onChange ="formHandler(this.form)">
<OPTION VALUE="">--Select a Subcategory--
<OPTION VALUE="/links/subcat1/">subcat1
<OPTION VALUE="/links/subcat2/">subcat2
<OPTION VALUE="/links/subcat3/">subcat3
</SELECT></FORM>
Maybe this could be SUB3.
This would make my life immeasurably easier.
Thanks again for the nice mod.
Aaron
------------------
www.serve.com/garden/geosearcher
[This message has been edited by Aaron (edited June 23, 1999).]
Jun 23, 1999, 7:22 AM
Veteran (2260 posts)
Jun 23, 1999, 7:22 AM
Post #6 of 34
Views: 8160
well, you put SUB in the description of the category that you want to show up with the sub categories...
FIRST.. try it on your "root" category... the most popular seems to be "Computers", so let's say "Computers".. go to the administration place and modify the category "Computers".. edit it's description to say:
SUB
then build the pages.. if it still just writes "SUB" it's probably cause that category has no sub categories in it...
Hope that helps
Jerry
FIRST.. try it on your "root" category... the most popular seems to be "Computers", so let's say "Computers".. go to the administration place and modify the category "Computers".. edit it's description to say:
SUB
then build the pages.. if it still just writes "SUB" it's probably cause that category has no sub categories in it...
Hope that helps
Jerry
Jun 23, 1999, 8:34 AM
Veteran (2260 posts)
Jun 23, 1999, 8:34 AM
Post #8 of 34
Views: 8168
I went ahead and implemented what aaron wanted... the thing is that you will need to supply your own javascript / form for it... if you don't want the javascript thingy.. use the original one i posted on top....
1. Find in site_html.pl in the subcategory site_html_print_cat:
REPLACE WITH:
$output = qq~<div class="margin"><form name = "##CHANGE##"><table width="80%" border="0" cellspacing="0" cellpadding="0"><tr><td class="catlist" valign="top">\n~;
2. Find in site_html.pl in the subcategory site_html_print_cat:
REPLACE WITH:
if ($#{$subcategories{$subcat}} >= 0 && $description =~ /^SUB.*/) {
$v = 0;
$output .= qq~<$font_small>~;
foreach $subcatsub (sort @{$subcategories{$subcat}}) {
$suburl = "$build_root_url/" . &urlencode($subcatsub) . "/";
if ($subcatsub =~ m,.*/([^/]+)$,) { $subcategory_name = &build_clean($1); } else { $subcategory_name = &build_clean($subcatsub); }
$output .= qq~<br>~ if ($description =~ /2$/ | | $v eq "0"); #DELETE SPACE BETWEEN "| |"!!!
$output .= qq~&[nbsp];&[nbsp];~ if ($description =~ /2$/); #DELETE "["s and "]"s!!!
$output .= qq~<select><option value="">--Select a Subcategory--~ if ($description =~ /3$/ && $v eq "0");
$output .= qq~<a href="$suburl">$subcategory_name</a>~ if ($description =~ /1$/ | | $description =~ /2$/); #DELETE SPACE BETWEEN "| |"!!!
$output .= qq~<option value="$suburl">$subcategory_name~ if ($description =~ /3$/);
$output .= qq~, ~ if ($description =~ /1$/ && $v ne $#{$subcategories{$subcat}});
$output .= qq~</select>~ if ($description =~ /3$/ && $v eq $#{$subcategories{$subcat}});
$v++;
}
$output .= qq~</font>~;
}
else {
$output .= qq~<dd><span class="descript">$description</span></dd>~ if (!($description =~ /^[\s\n]*$/));
}
3. Find in site_html.pl in the subcategory site_html_print_cat:
REPLACE WITH:
$output .= "</td></tr></table></form></div>\n";
!!! YOU HAVE TO CHANGE 4 THINGS BY YOURSELF (the message board screwed them up or i couldn't do it..)
1. Change the form to point to a cgi, make the neccesary changes so that the script will work without a submit buttom...
2. Find: $output .= qq~<br>~ if ($description =~ /2$/ | | $v eq "0");
EDIT: "| |" shouldn't have a space in the middle. Delete the space.
3. The line below that, has 2 "&[nbsp];"s. Delete the "["s and the "]"s.
4. Two lines below that, delete the space in between the "| |" !!!
If you want subcategories that look like this:
Category
Subcat1, Subcat2, Subcat3
Type: "SUB1" into the categories description.
If you want subcategories that look like this:
Category
Subcat1
Subcat2
Subcat3
Type: "SUB2" into the categories description.
If you want subcategories that look like this:
Category
(Pulldown List of Subcategories)
TYPE: "SUB3" into the categories description.
OK... HOPE THAT HELPS
Jerry
[This message has been edited by widgetz (edited June 23, 1999).]
1. Find in site_html.pl in the subcategory site_html_print_cat:
Code:
$output = qq~<div class="margin"><table width="80%" border="0" cellspacing="0" cellpadding="0"><tr><td class="catlist" valign="top">\n~; REPLACE WITH:
$output = qq~<div class="margin"><form name = "##CHANGE##"><table width="80%" border="0" cellspacing="0" cellpadding="0"><tr><td class="catlist" valign="top">\n~;
2. Find in site_html.pl in the subcategory site_html_print_cat:
Code:
$output .= qq~<dd><span class="descript">$description</span></dd>~ if (!($description =~ /^[\s\n]*$/)); REPLACE WITH:
if ($#{$subcategories{$subcat}} >= 0 && $description =~ /^SUB.*/) {
$v = 0;
$output .= qq~<$font_small>~;
foreach $subcatsub (sort @{$subcategories{$subcat}}) {
$suburl = "$build_root_url/" . &urlencode($subcatsub) . "/";
if ($subcatsub =~ m,.*/([^/]+)$,) { $subcategory_name = &build_clean($1); } else { $subcategory_name = &build_clean($subcatsub); }
$output .= qq~<br>~ if ($description =~ /2$/ | | $v eq "0"); #DELETE SPACE BETWEEN "| |"!!!
$output .= qq~&[nbsp];&[nbsp];~ if ($description =~ /2$/); #DELETE "["s and "]"s!!!
$output .= qq~<select><option value="">--Select a Subcategory--~ if ($description =~ /3$/ && $v eq "0");
$output .= qq~<a href="$suburl">$subcategory_name</a>~ if ($description =~ /1$/ | | $description =~ /2$/); #DELETE SPACE BETWEEN "| |"!!!
$output .= qq~<option value="$suburl">$subcategory_name~ if ($description =~ /3$/);
$output .= qq~, ~ if ($description =~ /1$/ && $v ne $#{$subcategories{$subcat}});
$output .= qq~</select>~ if ($description =~ /3$/ && $v eq $#{$subcategories{$subcat}});
$v++;
}
$output .= qq~</font>~;
}
else {
$output .= qq~<dd><span class="descript">$description</span></dd>~ if (!($description =~ /^[\s\n]*$/));
}
3. Find in site_html.pl in the subcategory site_html_print_cat:
Code:
$output .= "</td></tr></table></div>\n"; REPLACE WITH:
$output .= "</td></tr></table></form></div>\n";
!!! YOU HAVE TO CHANGE 4 THINGS BY YOURSELF (the message board screwed them up or i couldn't do it..)
1. Change the form to point to a cgi, make the neccesary changes so that the script will work without a submit buttom...
2. Find: $output .= qq~<br>~ if ($description =~ /2$/ | | $v eq "0");
EDIT: "| |" shouldn't have a space in the middle. Delete the space.
3. The line below that, has 2 "&[nbsp];"s. Delete the "["s and the "]"s.
4. Two lines below that, delete the space in between the "| |" !!!
If you want subcategories that look like this:
Category
Subcat1, Subcat2, Subcat3
Type: "SUB1" into the categories description.
If you want subcategories that look like this:
Category
Subcat1
Subcat2
Subcat3
Type: "SUB2" into the categories description.
If you want subcategories that look like this:
Category
(Pulldown List of Subcategories)
TYPE: "SUB3" into the categories description.
OK... HOPE THAT HELPS
Jerry
[This message has been edited by widgetz (edited June 23, 1999).]
Jun 24, 1999, 5:16 AM
User (66 posts)
Jun 24, 1999, 5:16 AM
Post #16 of 34
Views: 8179
Ok, I got the SUB3 method working, with some modifications.
I am using templates, but it shouldn't matter, both templates and non templates use site_html.pl or site_html_templates.pl.
Here is what I have:
in site_html.pl in the subcategory site_html_print_cat:
YOU ONLY NEED TO MAKE CHANGES TO THIS PART
$v = 0;
# $output .= qq~<$font_small>~;
foreach $subcatsub (sort @{$subcategories{$subcat}}) {
$suburl = "$build_root_url/" . &urlencode($subcatsub) . "/";
if ($subcatsub =~ m,.*/([^/]+)$,) { $subcategory_name = &build_clean($1); } else { $subcategory_name = &build_clean($subcatsub); }
$output .= qq~~ if ($description =~ /2$/ | | $v eq "0");
$output .= qq~ ~ if ($description =~ /2$/);
$output .= qq~<FORM name = "form"><SELECT NAME="site" SIZE=1 onChange ="formHandler(this.form)"><option value="">--Select a Subcategory--~ if ($description =~ /3$/ && $v eq "0");
$output .= qq~<a href="$suburl">$subcategory_name</a>~ if ($description =~ /1$/ | | $description =~ /2$/);
$output .= qq~<option value="$suburl">$subcategory_name~ if ($description =~ /3$/);
$output .= qq~, ~ if ($description =~ /1$/ && $v ne $#{$subcategories{$subcat}});
$output .= qq~</select></form><BR>~ if ($description =~ /3$/ && $v eq $#{$subcategories{$subcat}});
$v++;
}
$output .= qq~</font>~;
}
else {
$output .= qq~<dd><font face="Times New Roman" size=1>$description</font>~ if (!($description =~ /^[\s\n]*$/));
}Nads in my Header.txt or header section (for non-templates) I included:
function formHandler(form){
var URL = form.site.options[form.site.selectedIndex].value;
window.location.href = URL;
}
</script>
I only have one possible imrovement: Is there a way to include a form even if there are no subdirectories? maybe just a form field that says "none"?
This would help immensly with formatting, and you could then use SUB3 in all of the category descriptions fields.
Aaron
------------------
www.serve.com/garden/geosearcher
[This message has been edited by Aaron (edited June 24, 1999).]
I am using templates, but it shouldn't matter, both templates and non templates use site_html.pl or site_html_templates.pl.
Here is what I have:
in site_html.pl in the subcategory site_html_print_cat:
YOU ONLY NEED TO MAKE CHANGES TO THIS PART
Code:
if ($#{$subcategories{$subcat}} >= 0 && $description =~ /^SUB.*/) { $v = 0;
# $output .= qq~<$font_small>~;
foreach $subcatsub (sort @{$subcategories{$subcat}}) {
$suburl = "$build_root_url/" . &urlencode($subcatsub) . "/";
if ($subcatsub =~ m,.*/([^/]+)$,) { $subcategory_name = &build_clean($1); } else { $subcategory_name = &build_clean($subcatsub); }
$output .= qq~~ if ($description =~ /2$/ | | $v eq "0");
$output .= qq~ ~ if ($description =~ /2$/);
$output .= qq~<FORM name = "form"><SELECT NAME="site" SIZE=1 onChange ="formHandler(this.form)"><option value="">--Select a Subcategory--~ if ($description =~ /3$/ && $v eq "0");
$output .= qq~<a href="$suburl">$subcategory_name</a>~ if ($description =~ /1$/ | | $description =~ /2$/);
$output .= qq~<option value="$suburl">$subcategory_name~ if ($description =~ /3$/);
$output .= qq~, ~ if ($description =~ /1$/ && $v ne $#{$subcategories{$subcat}});
$output .= qq~</select></form><BR>~ if ($description =~ /3$/ && $v eq $#{$subcategories{$subcat}});
$v++;
}
$output .= qq~</font>~;
}
else {
$output .= qq~<dd><font face="Times New Roman" size=1>$description</font>~ if (!($description =~ /^[\s\n]*$/));
}
Code:
<script language="JavaScript"> function formHandler(form){
var URL = form.site.options[form.site.selectedIndex].value;
window.location.href = URL;
}
</script>
I only have one possible imrovement: Is there a way to include a form even if there are no subdirectories? maybe just a form field that says "none"?
This would help immensly with formatting, and you could then use SUB3 in all of the category descriptions fields.
Aaron
------------------
www.serve.com/garden/geosearcher
[This message has been edited by Aaron (edited June 24, 1999).]
Jun 24, 1999, 6:38 AM
Veteran (2260 posts)
Jun 24, 1999, 6:38 AM
Post #17 of 34
Views: 8155
hm... yea..
after:
$v = 0;
# $output .= qq~<$font_small>~;
foreach $subcatsub (sort @{$subcategories{$subcat}}) {
$suburl = "$build_root_url/" . &urlencode($subcatsub) . "/";
if ($subcatsub =~ m,.*/([^/]+)$,) { $subcategory_name = &build_clean($1); } else { $subcategory_name = &build_clean($subcatsub); }
$output .= qq~~ if ($description =~ /2$/ | | $v eq "0");
$output .= qq~ ~ if ($description =~ /2$/);
$output .= qq~<FORM name = "form"><SELECT NAME="site" SIZE=1 onChange ="formHandler(this.form)"><option value="">--Select a Subcategory--~ if
($description =~ /3$/ && $v eq "0");
$output .= qq~<a href="$suburl">$subcategory_name</a>~ if ($description =~ /1$/ | | $description =~ /2$/);
$output .= qq~<option value="$suburl">$subcategory_name~ if ($description =~ /3$/);
$output .= qq~, ~ if ($description =~ /1$/ && $v ne $#{$subcategories{$subcat}});
$output .= qq~</select></form><BR>~ if ($description =~ /3$/ && $v eq $#{$subcategories{$subcat}});
$v++;
}
and before the else {
put something like:
$output .= qq~<FORM name = "form"><SELECT NAME="site" SIZE=1 onChange ="formHandler(this.form)"><option value="">--Select a Subcategory--~ if ($description =~ /3$/);
$output .= qq~<option value="none">None~ if ($description =~ /3$/);
}
this is off the top of my head.. i haven't tried it, so sorry if it doesn't work.. tell me if it doesn't work.. this will elminate the SUB1 and SUB2 from posting SUB1 and SUB2 as a description... but it will put an option thing with None in it for SUB3
Thanks!
Jerry
[This message has been edited by widgetz (edited June 24, 1999).]
after:
Code:
if ($#{$subcategories{$subcat}} >= 0 && $description =~ /^SUB.*/) { $v = 0;
# $output .= qq~<$font_small>~;
foreach $subcatsub (sort @{$subcategories{$subcat}}) {
$suburl = "$build_root_url/" . &urlencode($subcatsub) . "/";
if ($subcatsub =~ m,.*/([^/]+)$,) { $subcategory_name = &build_clean($1); } else { $subcategory_name = &build_clean($subcatsub); }
$output .= qq~~ if ($description =~ /2$/ | | $v eq "0");
$output .= qq~ ~ if ($description =~ /2$/);
$output .= qq~<FORM name = "form"><SELECT NAME="site" SIZE=1 onChange ="formHandler(this.form)"><option value="">--Select a Subcategory--~ if
($description =~ /3$/ && $v eq "0");
$output .= qq~<a href="$suburl">$subcategory_name</a>~ if ($description =~ /1$/ | | $description =~ /2$/);
$output .= qq~<option value="$suburl">$subcategory_name~ if ($description =~ /3$/);
$output .= qq~, ~ if ($description =~ /1$/ && $v ne $#{$subcategories{$subcat}});
$output .= qq~</select></form><BR>~ if ($description =~ /3$/ && $v eq $#{$subcategories{$subcat}});
$v++;
}
and before the else {
put something like:
Code:
elsif ($description =~ /^SUB.*/) { $output .= qq~<FORM name = "form"><SELECT NAME="site" SIZE=1 onChange ="formHandler(this.form)"><option value="">--Select a Subcategory--~ if ($description =~ /3$/);
$output .= qq~<option value="none">None~ if ($description =~ /3$/);
}
this is off the top of my head.. i haven't tried it, so sorry if it doesn't work.. tell me if it doesn't work.. this will elminate the SUB1 and SUB2 from posting SUB1 and SUB2 as a description... but it will put an option thing with None in it for SUB3
Thanks!
Jerry
[This message has been edited by widgetz (edited June 24, 1999).]
Jun 24, 1999, 10:38 AM
User (66 posts)
Jun 24, 1999, 10:38 AM
Post #18 of 34
Views: 8161
Ok, I got that to work. Even works on subdirectories. Here is what I have:
$v = 0;
# $output .= qq~<$font_small>~;
foreach $subcatsub (sort @{$subcategories{$subcat}}) {
$suburl = "$build_root_url/" . &urlencode($subcatsub) . "/";
if ($subcatsub =~ m,.*/([^/]+)$,) { $subcategory_name = &build_clean($1); } else { $subcategory_name = &build_clean($subcatsub); }
$output .= qq~~ if ($description =~ /2$/ | | $v eq "0");
$output .= qq~ ~ if ($description =~ /2$/);
$output .= qq~<font face="Arial" size=1><FORM name = "form"><SELECT NAME="site" SIZE=1 onChange ="formHandler(this.form)"><option value="">--Select a Subcategory--~ if ($description =~ /3$/ && $v eq "0");
$output .= qq~<a href="$suburl">$subcategory_name</a>~ if ($description =~ /1$/ | | $description =~ /2$/);
$output .= qq~<option value="$suburl">$subcategory_name~ if ($description =~ /3$/);
$output .= qq~, ~ if ($description =~ /1$/ && $v ne $#{$subcategories{$subcat}});
$output .= qq~</select></form>~ if ($description =~ /3$/ && $v eq $#{$subcategories{$subcat}});
$v++;
}
$output .= qq~</font>~;
}
elsif ($description =~ /^SUB.*/) {
$output .= qq~<font face="Arial" size=1><FORM name = "form"><SELECT NAME="site" SIZE=1 onChange ="formHandler(this.form)"><option value="">--Select a Subcategory--~ if ($description =~ /3$/);
$output .= qq~<option value="">None</select></form>~ if ($description =~ /3$/);
}
else {
$output .= qq~<dd><font face="Times New Roman" size=1>$description</font>~ if (!($description =~ /^[\s\n]*$/));
}
Next I think I will declare some variables and clean up my code.
Aaron
------------------
www.serve.com/garden/geosearcher
Code:
if ($#{$subcategories{$subcat}} >= 0 && $description =~ /^SUB.*/) { $v = 0;
# $output .= qq~<$font_small>~;
foreach $subcatsub (sort @{$subcategories{$subcat}}) {
$suburl = "$build_root_url/" . &urlencode($subcatsub) . "/";
if ($subcatsub =~ m,.*/([^/]+)$,) { $subcategory_name = &build_clean($1); } else { $subcategory_name = &build_clean($subcatsub); }
$output .= qq~~ if ($description =~ /2$/ | | $v eq "0");
$output .= qq~ ~ if ($description =~ /2$/);
$output .= qq~<font face="Arial" size=1><FORM name = "form"><SELECT NAME="site" SIZE=1 onChange ="formHandler(this.form)"><option value="">--Select a Subcategory--~ if ($description =~ /3$/ && $v eq "0");
$output .= qq~<a href="$suburl">$subcategory_name</a>~ if ($description =~ /1$/ | | $description =~ /2$/);
$output .= qq~<option value="$suburl">$subcategory_name~ if ($description =~ /3$/);
$output .= qq~, ~ if ($description =~ /1$/ && $v ne $#{$subcategories{$subcat}});
$output .= qq~</select></form>~ if ($description =~ /3$/ && $v eq $#{$subcategories{$subcat}});
$v++;
}
$output .= qq~</font>~;
}
elsif ($description =~ /^SUB.*/) {
$output .= qq~<font face="Arial" size=1><FORM name = "form"><SELECT NAME="site" SIZE=1 onChange ="formHandler(this.form)"><option value="">--Select a Subcategory--~ if ($description =~ /3$/);
$output .= qq~<option value="">None</select></form>~ if ($description =~ /3$/);
}
else {
$output .= qq~<dd><font face="Times New Roman" size=1>$description</font>~ if (!($description =~ /^[\s\n]*$/));
}
Next I think I will declare some variables and clean up my code.
Aaron
------------------
www.serve.com/garden/geosearcher
Jul 4, 1999, 11:32 PM
Enthusiast (504 posts)
Jul 4, 1999, 11:32 PM
Post #20 of 34
Views: 8164
Greetings All!
I copied Aarons code at the ned of this conversation and here is the error I get. I am using snap clone templates.
Error including libraries: syntax error at /home/nzcid/cgi-bin/links2/admin/site_html_templates.pl line 387, near "| |"
syntax error at /home/nzcid/cgi-bin/links2/admin/site_html_templates.pl line 390, near "| |"
Unmatched right bracket at /home/nzcid/cgi-bin/links2/admin/site_html_templates.pl line 437, at end of line
syntax error at /home/nzcid/cgi-bin/links2/admin/site_html_templates.pl line 437, near "}"
Make sure they exist, permissions are set properly, and paths are set correctly.
Any assistance to get this working would be great. I like what Aaron has done on his site with the sub-categories.
------------------
http://www.nzcid.godzone.net.nz
New Zealand Christian Internet Directory
I copied Aarons code at the ned of this conversation and here is the error I get. I am using snap clone templates.
Error including libraries: syntax error at /home/nzcid/cgi-bin/links2/admin/site_html_templates.pl line 387, near "| |"
syntax error at /home/nzcid/cgi-bin/links2/admin/site_html_templates.pl line 390, near "| |"
Unmatched right bracket at /home/nzcid/cgi-bin/links2/admin/site_html_templates.pl line 437, at end of line
syntax error at /home/nzcid/cgi-bin/links2/admin/site_html_templates.pl line 437, near "}"
Make sure they exist, permissions are set properly, and paths are set correctly.
Any assistance to get this working would be great. I like what Aaron has done on his site with the sub-categories.
------------------
http://www.nzcid.godzone.net.nz
New Zealand Christian Internet Directory
Umm....
Widgetz the mod you made is great. but i have a whole lot of links in one of my categories and the list just goes on and on and on...quite ugly. Is there anyway you can implement the 'more...' function?
------------------
_________________________
Regards,
Gian Wilson
The Hip Hop Network
http://www.hiphopnetwork.cjb.net
Get Your FREE PRIVATE PERSONAL e-mail address at http://www.hiphopnetwork.zzn.com
Widgetz the mod you made is great. but i have a whole lot of links in one of my categories and the list just goes on and on and on...quite ugly. Is there anyway you can implement the 'more...' function?
------------------
_________________________
Regards,
Gian Wilson
The Hip Hop Network
http://www.hiphopnetwork.cjb.net
Get Your FREE PRIVATE PERSONAL e-mail address at http://www.hiphopnetwork.zzn.com
Jul 8, 1999, 10:29 AM
Veteran (2260 posts)
Jul 8, 1999, 10:29 AM
Post #24 of 34
Views: 8163
that actually took me awhile.. i thought i had it.. but i didn't even test it out.. and then i reread the code.. and oh boy..
anyways here is the code:
$v = 0;
$sub_length = "";
$output .= qq~<small>~;
foreach $subcatsub (sort @{$subcategories{$subcat}}) {
$suburl = "$build_root_url/" . &urlencode($subcatsub) . "/";
if ($subcatsub =~ m,.*/([^/]+)$,) { $subcategory_name = &build_clean($1); } else { $subcategory_name = &build_clean($subcatsub); }
$sub_length .= qq~, ~ if ($description =~ /1$/ && $v ne "0");
$sub_length .= qq~$subcategory_name~ if ($description =~ /1$/);
if ($description =~ /1$/ && length($sub_length) > $subcat_length) {
$output .= qq~...~;
last;
}
else {
$output .= qq~, ~ if ($description =~ /1$/ && $v ne "0");
$output .= qq~<br>~ if ($description =~ /2$/ | | $v eq "0");
$output .= qq~&[nbsp];&[nbsp];~ if ($description =~ /2$/);
$output .= qq~<a href="$suburl">$subcategory_name</a>~;
$v++;
}
}
$output .= qq~</small>~;
}
else {
$output .= qq~<dd><span class="descript">$description</span></dd>~ if (!($description =~ /^[\s\n]*$/));
}
follow the instructions from the original.. REMEMBER to change "| |"s so that they don't have a space in the middle... and the "&[nbsp];" so they don't have the "["s and "]"s...
you will have to create a new variable in "links.cfg"
put
and set the number to the number of characters you want to show up..
hope that helps you..
Jerry
[This message has been edited by widgetz (edited July 08, 1999).]
anyways here is the code:
Code:
if ($#{$subcategories{$subcat}} >= 0 && $description =~ /^SUB.*/) { $v = 0;
$sub_length = "";
$output .= qq~<small>~;
foreach $subcatsub (sort @{$subcategories{$subcat}}) {
$suburl = "$build_root_url/" . &urlencode($subcatsub) . "/";
if ($subcatsub =~ m,.*/([^/]+)$,) { $subcategory_name = &build_clean($1); } else { $subcategory_name = &build_clean($subcatsub); }
$sub_length .= qq~, ~ if ($description =~ /1$/ && $v ne "0");
$sub_length .= qq~$subcategory_name~ if ($description =~ /1$/);
if ($description =~ /1$/ && length($sub_length) > $subcat_length) {
$output .= qq~...~;
last;
}
else {
$output .= qq~, ~ if ($description =~ /1$/ && $v ne "0");
$output .= qq~<br>~ if ($description =~ /2$/ | | $v eq "0");
$output .= qq~&[nbsp];&[nbsp];~ if ($description =~ /2$/);
$output .= qq~<a href="$suburl">$subcategory_name</a>~;
$v++;
}
}
$output .= qq~</small>~;
}
else {
$output .= qq~<dd><span class="descript">$description</span></dd>~ if (!($description =~ /^[\s\n]*$/));
}
follow the instructions from the original.. REMEMBER to change "| |"s so that they don't have a space in the middle... and the "&[nbsp];" so they don't have the "["s and "]"s...
you will have to create a new variable in "links.cfg"
put
Code:
$subcat_length = "30";and set the number to the number of characters you want to show up..
hope that helps you..
Jerry
[This message has been edited by widgetz (edited July 08, 1999).]