Gossamer Forum
Home : Products : Links 2.0 : Customization :

Line breaks in description?

(Page 1 of 2)
> >
Quote Reply
Line breaks in description?
I can't seem to get line breaks in my descriptions. For example, instead of this:
___________________________________________
The quick red fox jumped over the lazy brown
dog. The quick red fox jumped over the lazy
brown dog. The quick red fox jumped over the
lazy brown dog. The quick red fox jumped over
the lazy brown dog.
____________________________________________

I want this:
____________________________________________
The quick red fox jumped over the lazy brown
dog.

The quick red fox jumped over the lazy brown
dog.

The quick red fox jumped over the lazy brown
dog.

The quick red fox jumped over the lazy brown
dog.
____________________________________________

Any help appreciated! Thanks.
Quote Reply
Re: Line breaks in description? In reply to
Have you tried hard returns???

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Line breaks in description? In reply to
Yes, but they are not seen.
Quote Reply
Re: Line breaks in description? In reply to
you can do this

$rec{'Description'} =~ s,\n,<br>,g;

before it gets outputted in the templts..

my keyboard is getting relly screwd up.. for some unknown rason..

jerry
Quote Reply
Re: Line breaks in description? In reply to
Mmmm... I placed your suggestion like this in the sub site_html_link section of site_html.pl:

if ($rec{'Description'}) { $output .= qq| <BR><$font_sm>$rec{'Description'}=~ s,\n,<br>,g;</font>\n|; }

but it comes out like:

___________________________________________
The quick red fox jumped over the lazy brown
dog. The quick red fox jumped over the lazy
brown dog. The quick red fox jumped over the
lazy brown dog. The quick red fox jumped over
the lazy brown dog.=~ s,\n,<br>,g;
____________________________________________

What did I miss?
Quote Reply
Re: Line breaks in description? In reply to
place it how i said to place it.. don't try to change anything..

jerry
Quote Reply
Re: Line breaks in description? In reply to
I don't understand. I placed it where I figured you meant me to place it. I just copied and pasted it after $rec{'Description'}. Please explain. I don't use templates, if that's what you are refering to.
Quote Reply
Re: Line breaks in description? In reply to
it goes on it's own line.. not in a line...

jerry
Quote Reply
Re: Line breaks in description? In reply to
You lost me. I put it on a line by itself (copied and pasted it from here) but I get:
___________________________________________
The quick red fox jumped over the lazy brown
dog. The quick red fox jumped over the lazy
brown dog. The quick red fox jumped over the
lazy brown dog. The quick red fox jumped over
the lazy brown dog.=~ s,\n,,g;
____________________________________________

Of course it is between $output = qq| and |; because without them nothing shows. It looks like:

sub site_html_link {
# --------------------------------------------------------
# This routine is used to display what a link should look
# like. It's a little complex looking just because we have to
# check for blank entries..

my (%rec) = @_;
$output .= qq|
$rec{'Description'} =~ s,\n,<br>,g;
|;

return $output;
}
Quote Reply
Re: Line breaks in description? In reply to
Any one else have any suggestions on this? Let me know what I'm missing here...

The only place I can figure to add the code suggested by Widgetz is in the sub site_html_link section of site_html.pl (I am not using templates) and as far as I can tell in order for anything to show when pages are built is to encase the code in $output .= qq|--- |; . If I just put the code in this section nothing shows at all.

Thanks in advance!
Quote Reply
Re: Line breaks in description? In reply to
in sub site_html_link in site_html.pl right after this

my (%rec) = @_;
my $rec_title = $rec{'Title'};
$rec_title =~ s/ /%20/g;

put:
$rec{'Description'} =~ s,\n,<br>,g;

Hope it works for you.

Derek



------------------
One click for your DJ mix fix...
www.djmixes.com/
Quote Reply
Re: Line breaks in description? In reply to
No, all that did was not show any links at all, just shows the numbers "444", whatever that means?



Quote Reply
Re: Line breaks in description? In reply to
ted..

ok.. LAST TIME...


under:

Code:
my (%rec) = @_;

add..

Code:
$rec{'Description'} =~ s,\n,<br>,g;

if you say it doesn't work one more time.. you should try it again.... if it still doesn't work.. try it again.... if that doesn't work.. try AGAIN.... if that doesn't help.. then get someone to TRY AGAIN for you.. get your neighbor to try again for all i care Smile

the point is.. I KNOW that works..

ok.. to make it EVEN easier....!!!

Code:
sub site_html_link {
# --------------------------------------------------------
# This routine is used to display what a link should look
# like. It's a little complex looking just because we have to
# check for blank entries..

my (%rec) = @_;
$rec{'Description'} =~ s,\n,<br>,g;
return $rec{'Description'};
}

if you don't get it to work with that.. try the post man when he comes on monday..

jerry
Quote Reply
Re: Line breaks in description? In reply to
Thanks, with the addition of "return $rec{'Description'};" after "$rec{'Description'} =~ s,\n,<br>,g;" from your last suggestion, it does work.

Only problem is now is that the description is all that is displayed. There is no title, ratings, votes, hits, new, etc. When I try to add any of these things then I run into the same problems as before.

Perhaps where the confusion is arising is that my sub site_html_link looks like:

sub site_html_link {
# --------------------------------------------------------
# This routine is used to display what a link should look
# like. It's a little complex looking just because we have to
# check for blank entries..

my (%rec) = @_;

$output = qq|
<CENTER>
<HR ALIGN="CENTER" WIDTH="96%" NOSHADE>
<TABLE BORDER="0" CELLPADDING="8" CELLSPACING="0" WIDTH="98%" BGCOLOR="#404040"><TR><TD>
<a href="$build_jump_url?$db_key=$rec{$db_key}" target="_new" onMouseOver="top.window.status='Click here to visit this site!'; return true"><$font_lg><B>$rec{'Title'}</B></font></a> |;

if ($rec{'isNew'} eq "Yes") { $output .= qq| <$font_new><b>New!</b></font> |; }
if ($rec{'isPopular'} eq "Yes") { $output .= qq| <$font_pop><b>Hot!</b></font> |; }
$output .= qq| <$font_date>(Rating: $rec{'Rating'} Votes: $rec{'Votes'}) <a href="$build_rate_url?ID=$rec{'ID'}" onMouseOver="top.window.status='Click here to rate this site!'; return true"><B>Rate It!</B></a></font>|;
if ($rec{'Description'}) { $output .= qq| <BR><$font_sm>$rec{'Description'}</font>\n|; }
$output .= qq| <$font_date>(Added: $rec{'Date'} Hits: $rec{'Hits'})</font><BR></TD></TR></TABLE></CENTER>|;


return $output;
}


As always, your suggestions are welcomed!
Quote Reply
Re: Line breaks in description? In reply to
it's actually the same..

$rec{'Description'} =~ s,\n,<br>,;

underneath

my (%rec) = @_;

jerry
Quote Reply
Re: Line breaks in description? In reply to
I've always added:

<BR>

to the description and it works fine. This doesn't cause a problem does it?

Shane
Quote Reply
Re: Line breaks in description? In reply to
i think ted's site is a poetry site.. right?

shane.. it doesn't cause a problem.. but since ted's site is a poetry site.. when someone enters like..

This is my haiku
I do not know how to write them
But I think I'm right

rather than type <br> at the ends of each.. you can change each \n to <br>.. \n is newline in perl..

you can do this too..

$rec{'Description'} =~ s,\n\n,<p>,;
$rec{'Description'} =~ s,\n,<br>,;

to do paragraphs..

jerry
Quote Reply
Re: Line breaks in description? In reply to
Eureka, it works! Once again, Jerry, you the man! Hat's off to you! (I apologize for trying your patience. Sometimes I try to think too much. Smile)

To summarize, for anyone else wishing to have line breaks or paragraphs in their descriptions the trick is to add:

$rec{'Description'} =~ s,\n\n,<p>,g;
$rec{'Description'} =~ s,\n,<br>,g;

directly below my (%rec) = @_; BUT above the $output = in the sub site_html_link section of site_html.pl. For example:

sub site_html_link {
# --------------------------------------------------------
# This routine is used to display what a link should look
# like. It's a little complex looking just because we have to
# check for blank entries..

my (%rec) = @_;
$rec{'Description'} =~ s,\n\n,<p>,g;
$rec{'Description'} =~ s,\n,<br>,g;

$output = qq|
<CENTER>
<HR ALIGN="CENTER" WIDTH="98%" NOSHADE>
<TABLE BORDER="0" CELLPADDING="8" CELLSPACING="0" WIDTH="98%" BGCOLOR="#505050"><TR><TD>
<a href="$build_jump_url?$db_key=$rec{$db_key}" target="_new" onMouseOver="top.window.status='Click here to visit this site!'; return true"><$font_lg><B>$rec{'Title'}</B></font></a>  |;

if ($rec{'isNew'} eq "Yes") { $output .= qq| <$font_new><b>New!</b></font> |; }
if ($rec{'isPopular'} eq "Yes") { $output .= qq| <$font_pop><b>Hot!</b></font> |; }
$output .= qq| <$font_date>(Rating: $rec{'Rating'} Votes: $rec{'Votes'}) <a href="$build_rate_url?ID=$rec{'ID'}" onMouseOver="top.window.status='Click here to rate this site!'; return true"><B>Rate It!</B></a></font>|;
if ($rec{'Description'}) { $output .= qq| <BR><$font_sm>$rec{'Description'}</font>\n|; }
$output .= qq| <$font_date>(Added: $rec{'Date'} Hits: $rec{'Hits'})</font><BR></TD></TR></TABLE></CENTER>|;


return $output;
}


Thanks to all!

[This message has been edited by Ted Monk (edited December 27, 1999).]

[This message has been edited by Ted Monk (edited December 27, 1999).]
Quote Reply
Re: Line breaks in description? In reply to
Okay, I've tried this hack on my links (using templates though) and it will not work. Any thoughts? Retains the line breaks in validation part but will not output them in the actual page. Tried it exclusive in site_html.pl in the appropriate area exactly as shown as well as then trying in site_html_template.pl. But absolutely no luck. Is this possible to get working for templates?
Quote Reply
Re: Line breaks in description? In reply to
You have placed the following codes:

Code:
$rec{'Description'} =~ s,\n\n,<p>,g;
$rec{'Description'} =~ s,\n,<br>,g;

underneath the following codes:

Code:
my %rec = @_;

in the sub site_html_link routine in the site_html_templates.pl file, right?

And your Description field is called Description, right?

If so, I don't know why it is not working.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
http://www.anthrotech.com
Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
----------------------





Quote Reply
Re: Line breaks in description? In reply to
Yeah, Eliot I do. But just realized I was mainly trying to get to work for extra add-in fields I made. So my stupid mistake for crying wolf. But how one go about applying it then to other fields? Require added sub routines or something?
Quote Reply
Re: Line breaks in description? In reply to
NO...Just replace Description with the name of your other fields!

Use the same codes, but replace Description with your other field names.

Make sense? I hope so.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
* Be sure to visit the Resource Center for FAQ's, Modifications and Extra Goodies!!
* Search Forums!
----------------------






Quote Reply
Re: Line breaks in description? In reply to
Obviously I don't check in here often.. sorry Smile

Well tried it out Eliot. Thing is it will retain everywhere else but the actual html page output (rebuilt and everything). Perhaps it's the fact that it's on a detailed page???? Anything special to make this work on a detailed page?

Sorry to be a pain. But this mod is majorly important and needed for me.
Quote Reply
Re: Line breaks in description? In reply to
I just placed this

$rec{'Description'} =~ s,\n,<br>,;

in the site_html_templates.pl in the sub detailed portion like so:

sub site_html_detailed {
# --------------------------------------------------------
# This routine will build a single page per link. It's only
# really useful if you have a long review for each link --
# or more information then can be displayed in a summary.
#
my %rec = @_;

$rec{'Detailed'} =~ s,\n\n,<p>,g;
$rec{'Detailed'} =~ s,\n,<br>,g;

return &load_template ('detailed.html', {
total => $total,
grand_total => $grand_total,
title_linked => $title_linked,
%rec,
%globals
} );
}


hope that works for you for detailed pages (ps. it will not show formatting during validation, just after the build)
Quote Reply
Re: Line breaks in description? In reply to
THANKS Hotwheel!!!!! I tried the same stuff a couple days ago in the detailed sub of site_html.pl and was a no go. Only thing that worked was putting it in site_html_template as you suggested. Thanks!

[This message has been edited by JL (edited January 31, 2000).]
> >