format comments?

Creating and modifying plugins.
Post Reply
sph
Regular
Posts: 62
Joined: Wed Apr 26, 2006 3:28 pm

format comments?

Post by sph »

hi!

mh - i thought i finished my blog, but now i found some kind of "bug" there: the comments.

the text entered in the comments is just shown without any text-format. no linebreak, nothing.

just one line (or more, if lots of words...).

but... well... i'm using some textformat-plugins, which should, like the configuration says, work for the comments, too... o.0

- text-format serendipity
- text-format linebreak

what am i missing? where is my error? a friend of mine meant that this just had to be a plugin, or a configuration in the admin-area. but i searched and checked a lot, without success...

help, anybody?

nice days, greets!
the island of stupid - come to where the monkey is...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: format comments?

Post by garvinhicking »

Hi!

When you enter the config of your nl2br markup plugin, is it enabled to apply to comments?

Any other markup plugins you'Ve got installed?

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
sph
Regular
Posts: 62
Joined: Wed Apr 26, 2006 3:28 pm

Post by sph »

hi!

umm, things like

"text-format: smileys"

doesn't count, i guess. so, there is nothing else. does "clean common xhtml errors" matter?


eh... and...


me and the nl2br-plugin had some differences. so at least i de-installed it. if i use this thingy it's a pain in the ass to correct all these linebreak-things it's doing to my entries.

well, at least: not to all entries, but there are some strange behaviours, so i kicked it out.

this was... not good?

:(
the island of stupid - come to where the monkey is...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

This was not good at least for your commenting users. :)

Instead you should just configure the nl2br plugin ton only apply to comments, and not to entries etc.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
sph
Regular
Posts: 62
Joined: Wed Apr 26, 2006 3:28 pm

Post by sph »

these thing makes me mad.


okay, after caching all articles nl2br works on comments now - linebreaks are shown correct now :)

but: now i have some problems with smilies in the comments. some are shown as usual, some not - instead there ist a part of the html-code, like

Code: Select all

src="/templates/plastick/img/emoticon/mh.png" alt=":|" style="display: inline; vertical-align: bottom;" class="emoticon" />
uh. not nice... :-\

what to do? i think i should explain that i'm using a self-created smilie-config-file. but... without nl2br everything is allright... o.0


what to do? any ideas?



greets and thanx,

meh :)
the island of stupid - come to where the monkey is...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

I would need the full HTML output of that smilie problem. Can it be you installed the emoticate plugin twice? And it seems you changed the emoticon configuration by adding custom smilies, maybe you entered a wrong code there.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
sph
Regular
Posts: 62
Joined: Wed Apr 26, 2006 3:28 pm

Post by sph »

garvinhicking wrote: I would need the full HTML output of that smilie problem.
umm, i actually don't know what you mean, but better have a look for yourself:

http://blog.plastick.org/archives/114-n ... en....html

garvinhicking wrote: Can it be you installed the emoticate plugin twice?
... no o.0

garvinhicking wrote: And it seems you changed the emoticon configuration by adding custom smilies, maybe you entered a wrong code there.
i thought so first, yeah. but if the self-created smilies or their config were wrong - why are they shown correct if i uninstall 'nl2br'..?

strange: the error doesn't occur to all smilies.. just to some... but, not always to the same... o.0

look at the linked blogpage and the comments there.
the code-error you see is shown where a smilie was posted - a smilie which is shown correct some lines above... o.0

hope you (or maybe anyone else) can tell me what to do... -.-

mh, easiest solution: deactivate smilies in comments. would work... :D

greets!
the island of stupid - come to where the monkey is...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Your problem simply is that you are using a smilie rewrite rule that is matching the output of one of your other smilies! :-D

So your configuration array contains an error/problem, and you will need to change some of them. Tell me how your config array looks like.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
sph
Regular
Posts: 62
Joined: Wed Apr 26, 2006 3:28 pm

Post by sph »

because i do not exactly know _what_ you mean, i just guess something is wrong with my emoticon.inc.php.

if you like it or not, here it is!

Code: Select all

   <?php
   $serendipity['custom_emoticons'] = array(
    ":O"  => serendipity_getTemplateFile('img/emoticon/eek.png'),
    ":o"  => serendipity_getTemplateFile('img/emoticon/eek.png'),
    ":-o"  => serendipity_getTemplateFile('img/emoticon/eek.png'),
    ":'"  => serendipity_getTemplateFile('img/emoticon/cry.png'),
    ":("  => serendipity_getTemplateFile('img/emoticon/sad.png'),
    ":)"  => serendipity_getTemplateFile('img/emoticon/happy.png'),
    "8)"  => serendipity_getTemplateFile('img/emoticon/cool.png'),
    "^^"  => serendipity_getTemplateFile('img/emoticon/lol.png'),
    "#)"  => serendipity_getTemplateFile('img/emoticon/tuned.png'),
    ":+"  => serendipity_getTemplateFile('img/emoticon/bored.png'),
    ":|"  => serendipity_getTemplateFile('img/emoticon/mh.png'),
    ":p"  => serendipity_getTemplateFile('img/emoticon/tongue.png'),
    ";)"  => serendipity_getTemplateFile('img/emoticon/wink.png'),
    ":-O"  => serendipity_getTemplateFile('img/emoticon/eek.png'),
    ":')"  => serendipity_getTemplateFile('img/emoticon/cry.png'),
    ":-("  => serendipity_getTemplateFile('img/emoticon/sad.png'),
    ":-)"  => serendipity_getTemplateFile('img/emoticon/happy.png'),
    "8-)"  => serendipity_getTemplateFile('img/emoticon/cool.png'),
    ":D"  => serendipity_getTemplateFile('img/emoticon/lol.png'),
    ":-|"  => serendipity_getTemplateFile('img/emoticon/mh.png'),
    ":-P"  => serendipity_getTemplateFile('img/emoticon/tongue.png'),
    ":-p"  => serendipity_getTemplateFile('img/emoticon/tongue.png'),
    ":P"  => serendipity_getTemplateFile('img/emoticon/tongue.png'),
    ";-)"  => serendipity_getTemplateFile('img/emoticon/wink.png'),
    );
    ?>


so... damn... eh.. smiley rewite rule? wtf? :D

it's in this file there? maybe? or... not?

garvin..??


greets, a very confused sph...
the island of stupid - come to where the monkey is...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Smilies are Regular Expressions. You need to escape special regular expression characters. "|" is one of those. This is how your smilies should look like:

Code: Select all

   <?php
   $serendipity['custom_emoticons'] = array(
    ":O"  => serendipity_getTemplateFile('img/emoticon/eek.png'),
    ":o"  => serendipity_getTemplateFile('img/emoticon/eek.png'),
    ":\-o"  => serendipity_getTemplateFile('img/emoticon/eek.png'),
    ":'"  => serendipity_getTemplateFile('img/emoticon/cry.png'),
    ":\("  => serendipity_getTemplateFile('img/emoticon/sad.png'),
    ":\)"  => serendipity_getTemplateFile('img/emoticon/happy.png'),
    "8\)"  => serendipity_getTemplateFile('img/emoticon/cool.png'),
    "\^\^"  => serendipity_getTemplateFile('img/emoticon/lol.png'),
    "#\)"  => serendipity_getTemplateFile('img/emoticon/tuned.png'),
    ":\+"  => serendipity_getTemplateFile('img/emoticon/bored.png'),
    ":\|"  => serendipity_getTemplateFile('img/emoticon/mh.png'),
    ":p"  => serendipity_getTemplateFile('img/emoticon/tongue.png'),
    ";\)"  => serendipity_getTemplateFile('img/emoticon/wink.png'),
    ":\-O"  => serendipity_getTemplateFile('img/emoticon/eek.png'),
    ":'\)"  => serendipity_getTemplateFile('img/emoticon/cry.png'),
    ":\-\("  => serendipity_getTemplateFile('img/emoticon/sad.png'),
    ":\-\)"  => serendipity_getTemplateFile('img/emoticon/happy.png'),
    "8\-\)"  => serendipity_getTemplateFile('img/emoticon/cool.png'),
    ":D"  => serendipity_getTemplateFile('img/emoticon/lol.png'),
    ":\-\|"  => serendipity_getTemplateFile('img/emoticon/mh.png'),
    ":\-P"  => serendipity_getTemplateFile('img/emoticon/tongue.png'),
    ":\-p"  => serendipity_getTemplateFile('img/emoticon/tongue.png'),
    ":P"  => serendipity_getTemplateFile('img/emoticon/tongue.png'),
    ";\-\)"  => serendipity_getTemplateFile('img/emoticon/wink.png'),
    );
    ?>
Regards,
Garvin

so... damn... eh.. smiley rewite rule? wtf? :D

it's in this file there? maybe? or... not?

garvin..??


greets, a very confused sph...[/quote]
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
sph
Regular
Posts: 62
Joined: Wed Apr 26, 2006 3:28 pm

Post by sph »

heh! you're great, you know?

but... (hehe)

now the smileys are shown as text-smileys. in the comments. no images. just text.

like: :|

but hey! the code is away! now, whats next? what to to to put the images back there? ;)

greets!
the island of stupid - come to where the monkey is...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Hm, if the smilies are not converted to graphics, the regexp is wrong. Maybe you should try to escape less fields, like only replace "|" with "\|". Or if you're using double quotes, you might even need to use "\\|".

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
sph
Regular
Posts: 62
Joined: Wed Apr 26, 2006 3:28 pm

Post by sph »

nope. neither nor.

used \\ and \ - both shows text-smileys. was not such a good idea to use :| as a smiley-tag, eh?

other smileys seems to work.... mh... not nice... i'd better have known before... :-\
the island of stupid - come to where the monkey is...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

One last chance would be to use "\\\|". :-)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
sph
Regular
Posts: 62
Joined: Wed Apr 26, 2006 3:28 pm

Post by sph »

nope.

but - doesn't matter. now i know it's not good to use things like | for smilies, and - i used this new emoticon-face only twice since i made it.

so i just replaced the: | with: i - and everything is fine.

thanx garvin! ;)
the island of stupid - come to where the monkey is...
Post Reply