>Where "order" is an action in your controller where you can do
> something like:
>
> if (isset($_POST['items']))
> {
> $sortableitems = $_POST['items'];
>
> $i = 0;
> foreach ($sortableitems as $item)
> {
> $this->UsefulLink->id = $item;
> $this->UsefulLink->saveField('order', $i);
> $i++;
> }
> }
Should I put a <form></form> to include the view files,like
<form method="post">
> <ul id="items">
> <li id="item_1">Item</li>
> <li id="item_4">Other Item</li>
> </ul>
</form>
AND, for '' $this->UsefulLink->saveField('order', $i); ''
Should I creat a field called order in my, such as topics table?
FOR MY OWN ONE:
views/topics/index.thtml
<div style="height:200px;">
<div style="float:left;">
<ul id="items"
<?php foreach ($topics as $topic): ?>
<li><?php echo $topic['Topic']['name'] ?></li>
<?php endforeach; ?>
</div>
</div>
<? echo $ajax->sortable ("items",array('url'=>'order')) ?>
controller/topics_controller.php
if (isset($_POST['items']))
{
$sortableitems = $_POST['items'];
$i = 0;
foreach ($sortableitems as $item)
{
$this->Topic->id = $item;
$this->Topic->saveField('order', $i);
$i++;
}
}
AND, I creat a field called ORDER in my topics table.
IT doesn't work.
Can U help me to figure it out where should I edit for make it works?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Cake PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---