Wishing you a wish

Source: Internet
Author: User
Provides various official and user-released code examples. For code reference, you are welcome to exchange and learn. I have found a very beautiful wishing wall template on the Internet. In the morning, I spent some time writing this wishing wall program, share with you.

First, we traverse all the wishing lists: $query = mysql_query("select * from wishing_wall order by id desc limit 0, 50");
while ($row = mysql_fetch_array($query)) {
list($left, $top, $zindex) = explode('|', $row['xyz']);
$time = strtotime($row['addtime']);

$notes .= "

" . $row['name'] . "" . $row['id'] . "

" . $row['content'] . "

" . tranTime($time) . "

";
Then we put the wishing list in. container:



The code for dragging the suspension layer of the wishing wall through jQueryUI is as follows: Var zIndex = 0;
Function make_draggable (elements ){
Elements. draggable ({
Handle: 'dt', // drag the handle
Opacity: 0.8,
Containment: 'parent', // drag range
Start: function (e, ui ){
Ui.helper.css ('z-Index', ++ zIndex)
},
Stop: function (e, ui ){
$. Get ('ajax. php? Act = update_position ',{
X: ui. position. left,
Y: ui. position. top,
Z: zIndex,
Id: parseInt (ui. helper. attr ("data-id "))
});
}
});
}
PHP storage location: $act = htmlspecialchars($_GET['act']);
if ($act == 'update_position') {
if (!is_numeric($_GET['id']) || !is_numeric($_GET['x']) || !is_numeric($_GET['y']) || !is_numeric($_GET['z']))
die("0");

$id = intval($_GET['id']);
$x = intval($_GET['x']);
$y = intval($_GET['y']);
$z = intval($_GET['z']);

mysql_query("UPDATE wishing_wall SET xyz='" . $x . "|" . $y . "|" . $z . "' WHERE id=" . $id);

echo "1";
}
Wishing wall demonstration: Http://www.sucaihuo.com/php/136.html
The expression of the wishing wall form has not been done yet. Please follow the updates behind the wishing wall code.

Php?jquery=ajaxbeautiful wishing fruit .zip (239.97 KB download: 137 times)

AD: truly free, domain name + VM + enterprise mailbox = 0 RMB

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.