Page 1 of 1

Kommentar intern erstellen

Posted: Mon Sep 22, 2008 2:58 pm
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ß

Re: Kommentar intern erstellen

Posted: Tue Sep 23, 2008 11:31 am
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

Posted: Wed Oct 01, 2008 9:51 pm
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ß