Buy Now
Sign in

Latest Comments Module & linebreak

MagnusB , March 12 2009, 17:48
M
MagnusB 17
March 12 2009, 17:48 #26226
I am not sure if this have been discussed before, or if it is possible already, but anyway:

I have set my latest comment module to limit the body to 35 (or something), but still it happens that people manage to sneak in a linebreak before that, and the linebreak will also show up in the latest comment module. I was wondering if it was possible to implement a setting like Ignore linebreak or stop at linebreak, so that it won't look like this:
comment.png
Attachments
comment.png
comment.png
(18.98 KiB)
14392 Downloads/Views
admin 27
March 13 2009, 07:35 #26270
Hi Magnus,

you can do this by a simple hack to the module file, before this line:

$all_comments .= $current_comment_item;


add:

$current_comment_item = str_replace("<br>", "", $current_comment_item);


Cheers
Max
Max
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
M
MagnusB 17
March 13 2009, 15:36 #26328
I did that. so now it looks like:
$current_comment_item = str_replace("<br>", "", $current_comment_item);
$all_comments .= $current_comment_item;

But that prevents the comments from appearing as a list:
com.png
Did I do something wrong? I can be pretty stupid with these things..
Attachments
com.png
com.png
(11.55 KiB)
14364 Downloads/Views
admin 27
March 13 2009, 23:37 #26391
please show me the comment element format in the module config, it should have <br> at the end, change it to <br />

Regards
Max
Max
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
M
MagnusB 17
March 14 2009, 00:54 #26399
Friday the 13th and all, once I try something out in the 14th it works. I really need to write up a review for you guys at JED, and see if I can afford the subscription some time soon.

Or that brings me back to my original issue:
com.png
Attachments
com.png
com.png
(9.8 KiB)
14385 Downloads/Views
admin 27
March 14 2009, 18:50 #26444
Thanks Magnus, please show me the module configuration code you changed, this is the only change you made since you had all lines together ?

Max
Max
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
M
MagnusB 17
March 14 2009, 19:07 #26449
What I have done so far:
1. Added the code to helper.php (I think it was, sorry, my memory isn't too good)
2. Changed <br> to <br /> in module configuration

<a href="{page_link}#commentID{id}">{text}...</a>


My module configuration, comment row content. Tried adding <br /> back but it keeps disappearing after I save it?
admin 27
March 14 2009, 19:47 #26463
Hi Magnus,

2. Changed <br> to <br /> in module configuration


I don't see neither <br> nor <br /> in the code line! you needed <br /> at the end! backup this line then completely remove it and Apply, what do you get as a result ?

Max
Max
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
M
MagnusB 17
March 14 2009, 20:50 #26492
Removing it results in no comments being shown. If I change it to <br> it will put all comments on one line, instead of each comment on a separate line. If I change it to <br /> it will just remove it when I save it, and when I open it again it will be the line I posted above.

As when I try to save:
<a href="{page_link}#commentID{id}">{text}...</a><br />

It saves OK, but when I open the module configuration page again it shows:
<a href="{page_link}#commentID{id}">{text}...</a>
admin 27
March 16 2009, 14:16 #26607
Hi Magnus,

This is weird, why its removed, lets try another way!

use this :

<p><a href="{page_link}#commentID{id}">{text}...</a></p>


let me know!

Cheers
Max
Max
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
M
MagnusB 17
March 16 2009, 16:14 #26638
</p> brings about the same problem as <br>, all in one line. But adding <br /> at the end seems to move them to separate lines, even though it is gone the next time I open the module configuration screen. Still isn't working with the line break though. Doesn't matter too much to me, just a feature that would be nice to add in the module.
admin 27
March 16 2009, 20:12 #26684
Hi Magnus,

That's Ok, I will copy this to the bugs forums and check it on time!

Cheers
Max
Max
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
M
MagnusB 17
March 16 2009, 21:10 #26707
Sure, thanks for all the help so far.
P
peterkphoto 2
January 31 2012, 01:57 #265733
"admin":
Hi Magnus,

you can do this by a simple hack to the module file, before this line:

$all_comments .= $current_comment_item;


add:

$current_comment_item = str_replace("<br>", "", $current_comment_item);


Cheers
Max


AWESOME!! Thanks.