php comment
// This is a single-line comment
# This is also a single-line comment
/*
This is a multiple-lines comment block
that spans over multiple
lines
*/
php comment
// This is a single-line comment
# This is also a single-line comment
/*
This is a multiple-lines comment block
that spans over multiple
lines
*/
php proper function comments
/**
* This function compiles a message that tells you how great coffee is
*
* @param string $compliment A nice word to describe coffee
* @param integer $score A score out of 10
*/
comment php
// This is a single-line comment
# This is also a single-line comment
/*
This is a multiple-lines comment block
that spans over multiple
lines
*/
comments in php
//For a single line comment use //:
//this is a comment too
//for multi-line comments use /* and */:
/* <--start of multi-line comment
this is a comment
this is a comment too (end of multi-line comment)-->*/
how to make a comment in php
// single line comment
/* multi line comment
hello
*/
php code for comment system
$(document).ready(function(){
// When user clicks on submit comment to add comment under post
$(document).on('click', '#submit_comment', function(e) {
e.preventDefault();
var comment_text = $('#comment_text').val();
var url = $('#comment_form').attr('action');
// Stop executing if not value is entered
if (comment_text === "" ) return;
$.ajax({
url: url,
type: "POST",
data: {
comment_text: comment_text,
comment_posted: 1
},
success: function(data){
var response = JSON.parse(data);
if (data === "error") {
alert('There was an error adding comment. Please try again');
} else {
$('#comments-wrapper').prepend(response.comment)
$('#comments_count').text(response.comments_count);
$('#comment_text').val('');
}
}
});
});
// When user clicks on submit reply to add reply under comment
$(document).on('click', '.reply-btn', function(e){
e.preventDefault();
// Get the comment id from the reply button's data-id attribute
var comment_id = $(this).data('id');
// show/hide the appropriate reply form (from the reply-btn (this), go to the parent element (comment-details)
// and then its siblings which is a form element with id comment_reply_form_ + comment_id)
$(this).parent().siblings('form#comment_reply_form_' + comment_id).toggle(500);
$(document).on('click', '.submit-reply', function(e){
e.preventDefault();
// elements
var reply_textarea = $(this).siblings('textarea'); // reply textarea element
var reply_text = $(this).siblings('textarea').val();
var url = $(this).parent().attr('action');
$.ajax({
url: url,
type: "POST",
data: {
comment_id: comment_id,
reply_text: reply_text,
reply_posted: 1
},
success: function(data){
if (data === "error") {
alert('There was an error adding reply. Please try again');
} else {
$('.replies_wrapper_' + comment_id).append(data);
reply_textarea.val('');
}
}
});
});
});
});
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us