10 Sep 2013

Published 18:55 by with 3 comments

PHPMOTION CHANGE COMMENT BOX FROM FCKEDITOR TO TEXTAREA

phpmotion comes with fckeditor as the comment box.in this tutorial am going to show how it is possible to remove that fckeditor and inert textarea. I am also going to show how to filter html tags from the comment.

phpmotion commentbox modification


here i am going to change the fckeditor for inner_play.htm (video comment box on video play page).
please follow the below steps to change the comment box.

01.open themes/default/templates/inner_play.htm
goto

<script type="text/javascript">
     <!--
     var sBasePath = '[var.base_url]/fckeditor/';
     var oFCKeditor = new FCKeditor('FCKeditor1');
     oFCKeditor.BasePath = sBasePath;
     oFCKeditor.ToolbarSet = 'Basic';
     oFCKeditor.Config['SkinPath'] = sBasePath + 'editor/skins/silver/';
     oFCKeditor.Height = 150;
     oFCKeditor.Value = '';
        oFCKeditor.Create();
     //-->
   </script>

and delete it and add the below code.

 <textarea id="FCKeditor1" name="FCKeditor1" rows='10' cols='60'/></textarea>


02.to change the fckeditor in edit comment open edit/editcomments.php
goto

///FCK EDITOR________________________________________________________________________
    include('../fckeditor/fckeditor.php');

    $sBasePath = "$base_url/fckeditor/";
    $oFCKeditor = new FCKeditor('FCKeditor1');
    $oFCKeditor->BasePath = $sBasePath;
    $oFCKeditor->CustomConfigurationsPath = "fckconfig.js";
    $oFCKeditor->ToolbarSet = 'Basic';
    $oFCKeditor->SkinPath = $sBasePath + 'editor/skins/silver/';

    $oFCKeditor->Value   = $comment;
    $oFCKeditor->Width   = '600';
    $oFCKeditor->Height = '220';
    $FCKeditor1 = $oFCKeditor->CreateHtml();
    $my_edit = $FCKeditor1;

and remove this
and add the below code

$my_edit  = "<textarea id='FCKeditor1' name='FCKeditor1' rows='20' cols='60'>$comment</textarea>";

now to filter html tags from the comments you may apply below steps.

01.open comments.php
goto

if ( isset( $_POST ) )
   $postArray = &$_POST;
else
   $postArray = &$HTTP_POST_VARS;

foreach ( $postArray as $sForm => $value ) {

and add the below code

$value   = strip_tags($value);

goto
$post_check = sizeof($postedValue);
if ( $post_check > 2) {
echo '<p align="center"><font color="#FF4242" face="Arial"><b>'.$config['video_comments_error_comment'].'</b></font>';
die();
}

$comments = $postedValue[0];
]

and add the below code
$comments   = strip_tags($comments);
]


now goto 
$user_id = mysql_real_escape_string($user_id);
$user_name = mysql_real_escape_string($user_name);
$vid = mysql_real_escape_string($vid);

and add the below code
$comments   = strip_tags($comments);

02.now open comments_ajax.php
goto

$text = $result['comments'];

and add the below code
$text = strip_tags($text);

03.open edit/editcomments.php
goto
if( isset($_POST['submit']) ) {
$commentid = (int) mysql_real_escape_string($_POST['id']);
$type = (int)mysql_real_escape_string($_POST['type']);
$comment = @mysql_real_escape_string($_POST['FCKeditor1']);

and add the below code

$comment = strip_tags($comment);

you may apply similar steps to change the comment box and also to filter html tags for other contents.



good day,
    email this       edit

3 comments:

  1. Hello you have any demo of this panel comments?

    ReplyDelete
  2. hi
    welcome,
    sorry I don't have any demo now but it will be available shortly as I am going to have demo site ready in short time.

    good day,
    Hiren Patel.

    ReplyDelete
  3. Hire PHP developer for coding as the work in web field is solely depends on the web developer.

    ReplyDelete

Hi, Thanks for the comment will try to reply at the earliest.

Good Day,
Hiren Patel
http://www.renruhak.org