Kommentar intern erstellen

Hier können Probleme und alles andere in Deutscher Sprache gelöst werden.
Post Reply
onli
Regular
Posts: 2829
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Kommentar intern erstellen

Post by onli »

Hi
Um einen Text zu formatieren nutzt das existierende Livecomment-Plugin das frontend_display-event. In Kombination mit jquery sähe das so aus:
Aufruf im Javascript:

Code: Select all

$.post(lcbase, 'data='+$('#serendipity_commentform_comment').val(), function(text){
                        alert(text);
                        },'html')
In der PHP:

Code: Select all

 case 'external_plugin':
 if ($eventData == 'livecomment') {
                        $data = array('comment' => $_REQUEST['data']);
                        serendipity_plugin_api::hook_event('frontend_display', $data);
                        echo $data['comment'];
                        } 
Steht im Kommentareingabefeld also *abc* wird <strong>abc</strong> daraus gemacht, wenn das s9y-markup-plugin aktiviert ist.

Nun wäre es ziemlich praktisch, wenn nicht nur das innere des Kommentars ausgegeben würde, sondern ein ganzer Kommentarblock. Also ein

Code: Select all

<div id="serendipity_comment_" class="serendipity_comment serendipity_comment_author_unknown  comment_oddbox" style="padding-left: 40px">
        <div class="serendipity_commentBody">
                    <strong>abc</strong>
                </div>
        <div class="serendipity_comment_source">
...
Kann man das irgendwie bewerkstelligen? Ohne Hilfestellung komme ich auf diesem Weg nicht weiter.
Gruß
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Kommentar intern erstellen

Post by garvinhicking »

Hi!

Dazu müsstest Du quasi das Template für die Kommentardarstellung rendern. Schau dir mal die include/functions_comments.inc.php an, dort die Funktion serendipity_printcomments(). Diese Funktion müsste dein plugin ansprechen, der returncode dieser funktion enthält das gerenderte HTML...

Grüße,
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/
onli
Regular
Posts: 2829
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Post by onli »

Danke. Ich hatte bis heute kein Internet mehr. In der Zwischenzeit bin ich von diesem Weg wieder etwas abgekommen - vielleicht kann ich das aber trotzdem noch gebrauchen.
Gruß
Post Reply