forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Miscellaneous => Topic started by: StoneHalo on January 12, 2004, 05:06:19 pm

Title: Line breaks in comments
Post by: StoneHalo 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
Title: Line breaks in comments
Post by: Joachim Müller 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
Title: Line breaks in comments
Post by: smarko 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};
Title: Line breaks in comments
Post by: LiX 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?
Title: Line breaks in comments
Post by: smarko 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 = '';
        }
Title: Line breaks in comments
Post by: LiX 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?
Title: linebreaks and single empty lines in comments?
Post by: michael singer 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?


Title: Re: linebreaks and single empty lines in comments?
Post by: Nibbler on November 01, 2004, 04:27:58 pm
nl2br() should have taken care of that.
Title: Re: Line breaks in comments
Post by: michael singer 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?
Title: Re: Line breaks in comments
Post by: Chrigi 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
Title: Re: Line breaks in comments
Post by: Joachim Müller on May 24, 2005, 10:13:13 pm
additional mod: Multiline Comments (http://forum.coppermine-gallery.net/index.php?topic=18217.0)
Title: Re: Line breaks in comments
Post by: robb 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.