Hi there!
I've made a sortable table in my custom CMS system. You can drag and drop
<tr>'s so they have another position.
This is the javascript in my sort.ctp file:
<script>
$(function() {
$('.sortable tbody').sortable({
axis: 'y',
scroll: true,
opacity: 0.5,
revert: 100,
cursor: 's-resize',
items: 'tr.grab',
// volledige breedte van <tr> behouden
helper: function (e, ui) {
ui.children().each(function () {
$(this).width($(this).width());
});
return ui;
},
stop: function (event, ui) {
var data = $(this).sortable('serialize');
// POST naar server ($.post of $.ajax)
$.ajax({
data: data,
type: 'POST',
url: '<?php echo APP . 'CoasterCms' . DS . 'Lib' . DS .
'sort.php'; ?>'
});
}
}).disableSelection();
});
</script>
Then, I've made a "sort.php" file and I've put it in the lib folder of my
plugin (CoasterCms/Lib/sort.php). Here's the place where the magic should
happen...
But it doesn't happen at all. The file currently looks like this:
<?php
$db = $this->getDataSource();
$db->updateAll(
array( // fields
'Attraction.show' => 'N'
),
array( // conditions
'Attraction.id' => 3
)
);
?>
Unfortunately, it does nothing. The baddest thing is that I can't test it
on errors because I cannot reach the lib file by an url. Is there anybody
who can guide me on the right way? How can I connect to my database and do
some update actions on a specific model?
Thanks for helping me ;)
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.