Project

General

Profile

« Previous | Next » 

Revision 1754

Added by Dietmar about 12 years ago

  1. fixed Duplicate entry for key 'PRIMARY' if adding a new pageX
    search for ->page['root_parent'] == 0 in module and shoe_menu2 calls
    page['root_parent'] has always the page_id from the first adding new page in level

View differences:

functions.php
478 478
	global $database;
479 479
	// Get page details
480 480
	$sql = 'SELECT `parent`, `level` FROM `'.TABLE_PREFIX.'pages` WHERE `page_id` = '.$page_id;
481

  
481 482
	$query_page = $database->query($sql);
482 483
	$fetch_page = $query_page->fetchRow();
483 484
	$parent = $fetch_page['parent'];
484 485
	$level = $fetch_page['level'];
485 486
	if($level == 1) {
486 487
		return $parent;
487
	}elseif($parent == 0) {
488
	} elseif($parent == 0) {
488 489
		return $page_id;
489
	}else {	// Figure out what the root parents id is
490
	} else {	// Figure out what the root parents id is
490 491
		$parent_ids = array_reverse(get_parent_ids($page_id));
491 492
		return $parent_ids[0];
492 493
	}

Also available in: Unified diff