Newline breaks in Comments

shazam
shazam's picture

Joined: 2002-08-25
Posts: 2
Posted: Sun, 2002-08-25 21:03

I noticed that Gallery doesn't translate newlines and new paragraphs from user comments correctly. A quick fix to anyone who wishes to do this:

in util.php within the function viewComments($index):

add the nl2br() function around the comment output. So

$commentdraw["comment"] = $comment->getCommentText(); becomes
$commentdraw["comment"] = nl2br($comment->getCommentText());

I'd like to suggest that in newer releases of Gallery, Captions and User Comments have this mod or something similar built-in.

Enjoy, for anyone who needs this.

Shazam
<!-- BBCode Start --><A HREF="http://www.g3D.com" TARGET="_blank">g3D</A><!-- BBCode End -->

 
zjs2k

Joined: 2002-08-24
Posts: 33
Posted: Mon, 2002-08-26 04:02

Thank you for pointing that out. It's simple but very useful. Actually I would love to see some more restrictions on using html in caption/description/title, just like what is done in those forum scripts (phpBB, vBB, etc.). There is a BBTag class made by yabb. It can be found in FreshMeat. Hopefully new G2 will include this feature.

After taking a closer look of current gallery, I noticed that although this is a great script, there are still a lot left to do. I just can't wait to see what G2 can do. But I guess we still need to wait until next year :???:

 
Gaile

Joined: 2002-07-20
Posts: 1301
Posted: Mon, 2002-08-26 19:39

Whooops...got parse error, but it was my bad, not yours! :lol:

Works great! Thanks!

Quick question: This would be helpful in the addition of captions as well (I've just been adding break tags) - I just have to find where to add it. If you have that figured out too, I'd love to know.

 
dtdgoomba

Joined: 2002-11-04
Posts: 185
Posted: Wed, 2003-02-05 21:46

Hey Pixel, what was your line parse error? I got one too when I put in 1.3.3 on my local box and upgraded my remote one. I got a fatal error

Call to a member function on a non-object in /home/sites/goombalooza/docs/gallery/util.php on line 74

I got rid of the nl2br( ) around that field and it works fine now. I don't think any of the patches i used affected that comment line.

anyway, if anyone can help, i was trying to look for a nl2br function, or is a php function that just isn't working for me? it's php v 4.23

 
Gaile

Joined: 2002-07-20
Posts: 1301
Posted: Wed, 2003-02-05 22:26
Quote:
Hey Pixel, what was your line parse error? I got one too when I put in 1.3.3 on my local box and upgraded my remote one. I got a fatal error

ACK! That was back in August....I have no idea what the error was, but most likely it was a typo on my part (often is when I'm in a hurry and stick in an extra space or something).

I really don't recall what it was now....sorry!

Gaile

 
dtdgoomba

Joined: 2002-11-04
Posts: 185
Posted: Wed, 2003-02-05 23:15

i figured that may happen since it was a while ago. I was checking the diff in that function from 1.3.2 to 1.3.3 and saw that, when i revert that line, it's ok. just curious..