Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Line breaks in comments  (Read 14513 times)

0 Members and 1 Guest are viewing this topic.

StoneHalo

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Line breaks in comments
« on: January 12, 2004, 05:06:19 pm »

These do not work. Is it possible to have line breaks in the comments? I don't think it looks good with them all on one line.

Thanks
« Last Edit: May 09, 2005, 07:20:36 am by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Line breaks in comments
« Reply #1 on: January 13, 2004, 05:15:02 am »

currently the text input box is an <input type="text" class="textinput" id="message" name="msg_body" ... > field. You can modify the code to make it a <textarea...> field to enable line breaks. Plain html, no php magic involved.
Please share your modifications...

GauGau
Logged

smarko

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 20
    • http://hoito.org
Line breaks in comments
« Reply #2 on: January 21, 2004, 12:30:37 am »

oh, this was easy.. I just changed <input type="text" class="textinput" id="message" name="msg_body" ... > to

(theme.php)
Code: [Select]
<textarea style="width: 100%;" rows="10" class="textinput" name="msg_body">{MSG_BODY_RAW}</textarea>

And a small change in a another file did the rest. Notice the use of nl2br -function.

(displayimage.php)
Code: [Select]
       if ($CONFIG['enable_smilies']) {
            $comment_body = process_smilies(make_clickable($row['msg_body']));
            $smilies = generate_smilies("f{$row['msg_id']}", 'msg_body');
        } else {
            $comment_body = nl2br(make_clickable($row['msg_body']));
            $smilies = '';
        }


---

And something for the admin, too.

[OPEN reviewcom.php]

[FIND]

Code: [Select]
$msg_date = localised_date($row['msg_date'], $comment_date_fmt);

[ADD AFTER]

Code: [Select]
$msgbody=nl2br(make_clickable($row['msg_body']));

[FIND]

Code: [Select]
{$row['msg_body']}

[REPLACE]

Code: [Select]
{$msgbody};
Logged

LiX

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 27
Line breaks in comments
« Reply #3 on: January 27, 2004, 06:07:50 pm »

Quote
Code: [Select]
     if ($CONFIG['enable_smilies']) {
            $comment_body = process_smilies(make_clickable($row['msg_body']));
            $smilies = generate_smilies("f{$row['msg_id']}", 'msg_body');
        } else {
            $comment_body = nl2br(make_clickable($row['msg_body']));
            $smilies = '';
        }


Where do ya put the above code?
Logged

smarko

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 20
    • http://hoito.org
Line breaks in comments
« Reply #4 on: January 27, 2004, 06:49:57 pm »

find

Code: [Select]
       if ($CONFIG['enable_smilies']) {
            $comment_body = process_smilies(make_clickable($row['msg_body']));
            $smilies = generate_smilies("f{$row['msg_id']}", 'msg_body');
        } else {
            $comment_body = make_clickable($row['msg_body']);
            $smilies = '';
        }


and replace it with

Code: [Select]
       if ($CONFIG['enable_smilies']) {
            $comment_body = process_smilies(make_clickable($row['msg_body']));
            $smilies = generate_smilies("f{$row['msg_id']}", 'msg_body');
        } else {
            $comment_body = nl2br(make_clickable($row['msg_body']));
            $smilies = '';
        }
Logged

LiX

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 27
Line breaks in comments
« Reply #5 on: January 27, 2004, 07:26:49 pm »

thanx smarko... ;) I'm not getting this to work properly though......

*textarea shows {MSG_BODY_RAW} on load
*doesn't handle line breaks
*smilies doesn't work...

any1 got this working?
Logged

michael singer

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 42
  • random image from: www.a-visual-notebook.at
    • a visual notebook
linebreaks and single empty lines in comments?
« Reply #6 on: November 01, 2004, 03:56:34 pm »

i would like to allow visitors to have linebreaks in their comments, as well as single empty lines.
i have found this thread  http://forum.coppermine-gallery.net/index.php?topic=3025.0
but the decribed mod does not work for me. in the textarea one can set linebreaks while writing, but they are not stored and displayed after submission of the comment.
is there a way to allow linebreaks in the comments so that they are displayed permanently, like they are stored in the database?


« Last Edit: November 01, 2004, 04:03:05 pm by okapi »
Logged

Nibbler

  • Guest
Re: linebreaks and single empty lines in comments?
« Reply #7 on: November 01, 2004, 04:27:58 pm »

nl2br() should have taken care of that.
Logged

michael singer

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 42
  • random image from: www.a-visual-notebook.at
    • a visual notebook
Re: Line breaks in comments
« Reply #8 on: November 01, 2004, 10:51:57 pm »

now i understand!
thank you very much for the help!

unfortunately this code seems to overrule my config. settings of the max. number of lines in a comment. empty lines seem not to be counted.
i can now set as many empty lines i want at my local test installation.
with this the layout could be easily ruined, at least vertically...

is there a way to set a limitation also for the number of empty lines?
« Last Edit: November 01, 2004, 11:09:50 pm by okapi »
Logged

Chrigi

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: Line breaks in comments
« Reply #9 on: May 02, 2005, 02:57:41 pm »

hi  guys

i have the same problem with the linebreaks in the comments.
but i also tried the solution given by smarko, but it doesnt work.
the comments was showing only in one line.

Has anybody the same problem? has anybody solutions for me?

thx
chrigi
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Line breaks in comments
« Reply #10 on: May 24, 2005, 10:13:13 pm »

additional mod: Multiline Comments
Logged

robb

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Line breaks in comments
« Reply #11 on: July 12, 2005, 04:59:16 pm »


While I am a complete luser my solution after reading every thread was: to implement first
http://forum.coppermine-gallery.net/index.php?topic=18217.0

and then
(theme.php)
change <input type="text" class="textinput" id="message" name="msg_body" ... > to

Code:
<textarea style="width: 100%;" rows="10" class="textinput" name="msg_body">textarea>

---cant guarantee your others success but since this is such an important mod, I mention for the newbies like myself, since there seem quite a few opinions.
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 19 queries.