Line breaks in comments Line breaks in comments
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Line breaks in comments

Started by StoneHalo, January 12, 2004, 05:06:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

StoneHalo

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

Joachim Müller

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

smarko

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

(theme.php)
<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)
       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]

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

[ADD AFTER]

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

[FIND]

{$row['msg_body']}

[REPLACE]

{$msgbody};

LiX

Quote      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?

smarko

find

       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

       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 = '';
        }

LiX

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?

michael singer

#6
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?



Nibbler


michael singer

#8
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?

Chrigi

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

Joachim Müller


robb


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.