Gossamer Forum
Home : Products : Links 2.0 : Customization :

Remove link spacing - help!

Quote Reply
Remove link spacing - help!
First you need to look at:
http://www.essay-search.com/essay_sites/

Then look at the source. You will see there is a large number of spaces between the two links. This is caused by our link.html template which looks like this...

<%if Sponsor%>
<tr><td bgcolor="#eeeeee">
<font face="arial,sans-serif"><a href="<%db_cgi_url%>/visit.cgi?ID=<%ID%>"><%Title%></a></font></td>
<td align="right" bgcolor="#eeeeee"><font face="verdana,arial" size="1"><b>SPONSORED LINK</b></font></td></tr>
<tr><td colspan="2" bgcolor="#eeeeee"><font size="-1" face="Arial"><%Description%></font><br><font size="-1" face="Arial" color="#999999"><%URL%><br></font></td>
</tr>
<%endif%>
<%ifnot Sponsor%>
<tr><td width="100%" colspan="2">
<font face="arial,sans-serif"><a href="<%db_cgi_url%>/visit.cgi?ID=<%ID%>"><%Title%></a></font><br>
<font size="-1" face="Arial"><%Description%></font><br>
<font size="-1" face="Arial" color="#999999"><%URL%><br></font></td></tr>
<%endif%>


How can I remove all that white space between the links? Any tips and help would be great!

Thanks

PS. The site is not finished by any means!

JeffB
GT customer for 6 years (and counting!)
Quote Reply
Re: [jeffb] Remove link spacing - help! In reply to
How do you mean remove the whitespace? It looks fine to me.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [AndyNewby] Remove link spacing - help! In reply to
If you look at the source on that page, you will see that there is about 4 empty lines between each of the links. This makes the page larger and reduces the capture of keywords by search engines. Take a look again Unimpressed

JeffB
GT customer for 6 years (and counting!)
Quote Reply
Re: [jeffb] Remove link spacing - help! In reply to
Those blank lines are remnants of conditional statements... you might try removing them with a regex in Template.pm like...

Code:
$text =~ s,\n+([^\n]),\n$1,g;

--Philip
Links 2.0 moderator
Quote Reply
Re: [King Junko II] Remove link spacing - help! In reply to
Or:

$text =~ s/\n{2,}/\n/sg;

Last edited by:

RedRum: Feb 13, 2002, 1:09 PM
Quote Reply
Re: [RedRum] Remove link spacing - help! In reply to
Thanks for your help, I actually tried doing a tr or s/// match before but couldn't get it to work! I was playing around in the sub parse inside templates.pm

At end of sub parse there is this...

Quote:


# Check for endif tags.
$line =~ s/(.*?)$begin\s*endif\s*$end(.*)/
($prev, $more) = ($1, $2);
$go[$depth] and ($temp .= $prev);
$go[$depth--] = 1;
"";
/oe;
if ($more) { $line = $more; redo LINE; }


# Add the content..
$go[$depth] and ($temp .= "$line\n");
}


# Replace the special variables, we allow code ref mapping.
$temp =~ s/$begin\s*(.+?)\s*$end/
if (exists $self->{'vars'}{$1}) {
ref ($self->{'vars'}{$1}) eq 'CODE' ?
&{$self->{'vars'}{$1}}($self->{'vars'}) : $self->{'vars'}{$1};
}
else { "Unkown Tag: $1"; }
/goe;


$self->{'parsed'}{$template} = $temp;

return $self->{'parsed'}{$template};
}


Following your suggestions I added this line...

Quote:
# Check for endif tags.
$line =~ s/(.*?)$begin\s*endif\s*$end(.*)/
($prev, $more) = ($1, $2);
$go[$depth] and ($temp .= $prev);
$go[$depth--] = 1;
"";
/oe;
if ($more) { $line = $more; redo LINE; }


# Add the content..
$go[$depth] and ($temp .= "$line\n");
}


# Replace the special variables, we allow code ref mapping.
$temp =~ s/$begin\s*(.+?)\s*$end/
if (exists $self->{'vars'}{$1}) {
ref ($self->{'vars'}{$1}) eq 'CODE' ?
&{$self->{'vars'}{$1}}($self->{'vars'}) : $self->{'vars'}{$1};
}
else { "Unkown Tag: $1"; }
/goe;


$temp =~ s/\n{2,}/\n/sg;

$self->{'parsed'}{$template} = $temp;

return $self->{'parsed'}{$template};
}
But nothing happened to the ouput. Sorry be to dumb, but which variable I am meant to be doing the search and replace on?

Thanks Cool

JeffB
GT customer for 6 years (and counting!)

Last edited by:

jeffb: Feb 13, 2002, 1:40 PM
Quote Reply
Re: [jeffb] Remove link spacing - help! In reply to
Try changing:

return $self->{'parsed'}{$template};

to:

$self->{'parsed'}{$template} =~ s/\n{2,}/\n/sg;
return $self->{'parsed'}{$template};
Quote Reply
Re: [RedRum] Remove link spacing - help! In reply to
Nope that still doesn't work Unsure

Anyone else got any ideas?

JeffB
GT customer for 6 years (and counting!)
Quote Reply
Re: [jeffb] Remove link spacing - help! In reply to
It should do.

Get drastic and try:

$self->{'parsed'}{$template} =~ s/[\r\t\n]+/\n/sg;
return $self->{'parsed'}{$template};
Quote Reply
Re: [RedRum] Remove link spacing - help! In reply to
You are my knight in shining armour Wink

Take that as confirmation your "drastic" solution worked!

Thanks,

Jeff.

JeffB
GT customer for 6 years (and counting!)
Quote Reply
Re: [jeffb] Remove link spacing - help! In reply to
Ah lovely jubly Smile