Gossamer Forum
Home : Products : Links 2.0 : Customization :

Can't single space subcategories..what's wrong?

Quote Reply
Can't single space subcategories..what's wrong?
Gentleman, I usually don't post anything here without trying for days first but I'm going in circles with something that I bet is going to be a simple thing to correct.

I'm trying to use categories with images on the side and everything seems to be working well except that I cannot get rid of a douple space problem between my Categories and Yahoo Style Subcategories. See link below:

http://dream2reality.com/pages/

Here is what my "site_html_templates" code looks like:




"site_html_templates"

# Then we print out the name linked, new if it's new, and popular if its popular.



if (@{$category{$subcat}}[9] =~ ".gif") {
$output .= qq|<dl><dt><img src="@{$category{$subcat}}[9]"><a class="link" href="$url">$category_name</a><small class="numlinks"> ($numlinks)</small></font> |;
}
else{
$output .= qq|<dl><dt><a href="$url">$category_name</a> ($numlinks) |;
}
$output .= qq|<medium><sup><font color="red">new</font></sup></medium>| if (&days_old($mod) < $db_new_cutoff);
$output .= qq|</dt>|;
$output .= qq|<dd><span>$description</span></dd>| if (!($description =~ /^[\s\n]*$/));
$output .= qq|</dl>|;


if ($subcatstyle =~ m,^\(([^\)]+)\)(\d)$, && $#{$subcategories{$subcat}} >= 0) {

($subcatstyle, $style) = ($1, $2);

$s = 0;

@subcatsub = split (/\|/, $subcatstyle);



$output .= qq~~ if ($style eq "1");

foreach $category_name (@subcatsub) {

foreach (sort @{$subcategories{$subcat}}) {

($subcatstyle eq "ALL" && $#subcatsub == 0) ?

($_ =~ m,.*/([^/]+)$, and $category_name = &build_clean($1)) :

($_ eq "$subcat/$category_name" or next);

if ($style eq "1") {

$length += length($category_name);

($length > $subcat_length) and last;

}

if ($s > 0) {

$output .= qq~, ~ and $length += 2 if ($style eq "1");

$output .= qq~ ~ if ($style eq "2");

}

$url = "$build_root_url/" . &urlencode($_) . "/";

$output .= qq~<LI>~ if ($style eq "2");

$output .= qq~<font face="Arial" size="1"><a href="$url">$category_name</a></font>~;



$s++;

last if ($subcatstyle ne "ALL" && $#subcatsub > 0);

}

}

undef $length;

if ($s < $#{$subcategories{$subcat}}) {

$output .= qq~...~ if ($style eq "1");

}

$output .= qq~<BR>~;

}

else { }}



# Don't forget to end the table..

$output .= "</td></tr></table></div>\n";

return $output;

}






I seem to be able to to fix the double spacing issue when I replace the </dl> and </dt> with <br> (see code below) but what happens next is this:

http://dream2reality.com/pages/sample.htm

My categories on the next page do not fall underneath each other.




# Then we print out the name linked, new if it's new, and popular if its popular.

if (@{$category{$subcat}}[9] =~ ".gif") {
$output .= qq|<dl><dt><img src="@{$category{$subcat}}[9]"><a class="link" href="$url">$category_name</a><small class="numlinks"> ($numlinks)</small></font> |;
}
else{
$output .= qq|<dl><dt><a href="$url">$category_name</a> ($numlinks) |;
}
$output .= qq|<medium><sup><font color="red">new</font></sup></medium>| if (&days_old($mod) < $db_new_cutoff);
$output .= qq|</dt>|;
$output .= qq|<dd><span>$description</span></dd>| if (!($description =~ /^[\s\n]*$/));
$output .= qq|</br>|;

http://dream2reality.com/pages/sample.htm




Can anyone help me tweak this problem?



Thank you bery much
Quote Reply
Re: [nova3470] Can't single space subcategories..what's wrong? In reply to
In your second example, you are nesting <dl> tags sets, which is not going to look very good.

In the first example, in the source code from the page linked you have this: </dl></dl> But I don't see where it's coming from with the code you pasted. Look at your category.html (template) and see if you have something there.

Other idea would be to define the size of the gif in the code ...height="10" width="10"...

Other than that problem, it looks like you're doing great!


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Can't single space subcategories..what's wrong? In reply to
PerlFlunkie, the solution you gave me below worked well! Thank you. But one last thing...I just have to adjust the double spacing here: http://dream2reality.com/pages/Travel/ and I'm all set.



I think the problem may be that a <dl> has a preset space under it. You can change this using CSS, in the links.css, change this (add the red, not the space):

/* Definition list */
dl {
color: #000000;
background: #FFFFFF;
font-family: "verdana", "arial", "geneva", sans-serif;

margin-bottom: 2px;
}




CURRENT CODE IN: "SITE HTML TEMPLATES"

# Then we print out the name linked, new if it's new, and popular if its popular.



if (@{$category{$subcat}}[9] =~ ".gif") {
$output .= qq|<dl><dt><img src="@{$category{$subcat}}[9]"><a class="link" href="$url">$category_name</a><small class="numlinks"> ($numlinks)</small></font> |;
}
else{
$output .= qq|<dl><dt><a href="$url">$category_name</a> ($numlinks) |;
}
$output .= qq|<medium><sup><font color="red">new</font></sup></medium>| if (&days_old($mod) < $db_new_cutoff);
$output .= qq|</dt>|;
$output .= qq|<dd><span>$description</span></dd>| if (!($description =~ /^[\s\n]*$/));


$output .= qq|</dl>|;


if ($subcatstyle =~ m,^\(([^\)]+)\)(\d)$, && $#{$subcategories{$subcat}} >= 0) {

($subcatstyle, $style) = ($1, $2);

$s = 0;

@subcatsub = split (/\|/, $subcatstyle);



# IN HERE YOU CAN SPACE THE SUBCATEGORIES LEFT TO RIGHT Sample: $output .= qq~&nsbp;~ if ($style eq "1");

$output .= qq~~ if ($style eq "1");

foreach $category_name (@subcatsub) {

foreach (sort @{$subcategories{$subcat}}) {

($subcatstyle eq "ALL" && $#subcatsub == 0) ?

($_ =~ m,.*/([^/]+)$, and $category_name = &build_clean($1)) :

($_ eq "$subcat/$category_name" or next);

if ($style eq "1") {

$length += length($category_name);

($length > $subcat_length) and last;

}

if ($s > 0) {

$output .= qq~, ~ and $length += 2 if ($style eq "1");

$output .= qq~ ~ if ($style eq "2");

}

$url = "$build_root_url/" . &urlencode($_) . "/";

$output .= qq~<LI>~ if ($style eq "2");

$output .= qq~<font face="Arial" size="1"><a href="$url">$category_name</a></font>~;



$s++;

last if ($subcatstyle ne "ALL" && $#subcatsub > 0);

}

}

undef $length;

if ($s < $#{$subcategories{$subcat}}) {

$output .= qq~...~ if ($style eq "1");

}

$output .= qq~<BR>~;

}

else { }}



# Don't forget to end the table..


$output .= "</td></tr></table></div>\n";


return $output;

}



1;



Quote Reply
Re: [nova3470] Can't single space subcategories..what's wrong? In reply to
Can you post a link to where you found the mod you are using? I have a few 'yahoo-style' mods, but none like that. Just need to compare code. Also, what style are you using (in the mod)?


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Can't single space subcategories..what's wrong? In reply to
Sure Leonard. You may have this one already but here you go just in case.


http://gossamer-threads.com/...mp;ubb=004954:Forum3