Skip to content

Navigation Menu

Sign up

Menu Index value when create new document #1911

ogumemura started this conversation in Show and tell
Discussion options

Thank you for all your help.

When creating a new page, the maximum value of the menu index is based on the number of contents existing in the same hierarchy, but it is assumed that the menu index starts from 0.
For the case where the menuindex does not start from 0, shouldn't it be set to the maximum value of the menu index + 1?

if($modx->config['auto_menuindex']) {
$pid = (int)$_REQUEST['pid'];
$rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'");
$content['menuindex'] = $modx->db->getValue($rs);
} else {

L140
$rs = $modx->db->select('max(menuindex)+1', $tbl_site_content, "parent='{$pid}'");

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant
Converted from issue

This discussion was converted from issue #1680 on March 10, 2021 15:18.

AltStyle によって変換されたページ (->オリジナル) /