background preloader

Comment

Facebook Twitter

Threaded array library for Codeigniter. Class threaded { public $parents = array(); public $children = array();

Threaded array library for Codeigniter

HOW-TO: Multi-level Comments In PHP. If you have noticed the way Youtube, Digg, Reddit formats your comments, you must have seen that your comments can be replied and the replies can be replied further (until a certain level.)

HOW-TO: Multi-level Comments In PHP

In this tutorial we are going to achive the same. Here I have created a table called 'threaded_comments'. id — Unique id of the comment.author — Name of the author of the comment.comment — Main comment body.created_at — The time when comment is made.parent_id — Id of the comment to which the current comment is a reply. The default value of this is 0 ('zero') (i.e the default value of a non-reply comment). Add some dummy data to it. INSERT INTO `threaded_comments`(`id`,`author`,`comment`,`created_at`,`parent_id`) VALUES (1,'cyberbuff','Lorem ipsum dolor sit amet, consectetuer adipiscing elit. INSERT INTO `threaded_comments`(`id`,`author`,`comment`,`created_at`,`parent_id`) VALUES (1,'cyberbuff','Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

Our layout is going to look like this: <? <? That's it! Styling Simple Nested Comments with CSS. Modern Tiny Ajax Comments System - Web Development Area. Facebook Style Wall Posting and Comments System using jQuery PHP and Ajax. Reloaded. <?

Facebook Style Wall Posting and Comments System using jQuery PHP and Ajax. Reloaded

Php include('dbcon.php'); function checkValues($value) // Use this function on all those values where you want to check for both sql injection and cross site scripting //Trim the value $value = trim($value); // Stripslashes if (get_magic_quotes_gpc()) { jQuery Ajax delete. Removing contents with Ajax is a useful tool to have in any web designers kit.

jQuery Ajax delete

Using a few lines of jQuery we can remove a div and simultaneously remove a record from the database with Ajax. In the download and demo you’ll see a small red cross to the right of each comment. Clicking the cross will remove the comment div with a slide up animation which will remove the div. click the image below to check out the demo. The Code We start by writing the dom ready function to simply hide our loading message div which is used as a visual representation to the user when we go to delete a comment. $(document).ready(function() { $('#load').hide(); }); The next block of code is what essentially does the hard work. we have a .click function to start with that when run fades in the ‘#load’ div to show the user that we’re deleting the item. We then set the variable ‘commentContainer’ which is set to represent the parent element to ‘.delete’ which is the div ‘.box’ as show in the image below. PHP and MySql Comment Form without Refreshing Page with jQuery. This article helps your comment form to submit without refreshing page.

In this tutorial I’ll show you how to create an in just a few lines of codes all we need to do is initialize the submitted post data and pass using jquery API and done, the data submitted is constructed using PHP, so sounds simple right? Yes it is. PHP and MySql Comment Form without Refreshing Page with jQuery index.html Here our HTML codes that contains the basic input data name, email, url and message. Comment system with jQuery, Ajax and PHP. This time I had developed Comment system with out refreshing page with jQuery, Ajax and PHP.

Comment system with jQuery, Ajax and PHP.

In this application I had implemented with gravatar image. It's is useful and simple just some lines of code. Take a look at the live demo effect. Updated Version :Click Here Download Script Live Demo.