[eluser]jvk22[/eluser]
I have a CMS that has main(parent) pages and sub pages(children). I'm trying to update the sort order of the pages. I've integrated a drag and drop script that I was able to get working for the parent pages, but not for the children.
By sort order I mean a user can update the order of the navigation.
EXAMPLE: Home | About | Contact
a user can change the order
EXAMPLE: Contact | Home | About
The main problem is I don't know what variable name $v should have. I've tried $v['children'] and $v[0]['children'], both do not work.
array
Code:
Array ( [left-to-right] => Array ( [0] => Array ( [id] => 2 ) [1] => Array ( [id] => 555 ) [2] => Array ( [id] => 3 ) [3] => Array ( [id] => 4 [children] => Array ( [0] => Array ( [id] => 5 [children] => Array ( [0] => Array ( [id] => 6 ) [1] => Array ( [id] => 666 ) ) ) ) ) ) )
code
Code:
<?php
print_r($_POST);
// run through the original array
foreach($_POST['left-to-right'] as $key=>$val) {
echo 'Sort Order" '.$key.'<br>';
// attempt to get children
foreach($val as $k=>$v)
{
echo $k.' '.print_r($v).'<br>';
}
}
?>