_menu_find_router_path
includes/menu.inc, строка 2054
- Версии
- 6
_menu_find_router_path($link_path)
Find the router path which will serve this path.
Параметры
$link_path
The path for we are looking up its router path.
Возвращаемое значение
A path from $menu
keys or empty if $link_path
points to a nonexisting
place.
Связанные темы
Код
<?php
function _menu_find_router_path($link_path) {
// $menu will only have data during a menu rebuild.
$menu = _menu_router_cache();
$router_path = $link_path;
$parts = explode('/', $link_path, MENU_MAX_PARTS);
list($ancestors, $placeholders) = menu_get_ancestors($parts);
if (empty($menu)) {
// Not during a menu rebuild, so look up in the database.
$router_path = (string)db_result(db_query_range('SELECT path FROM {menu_router} WHERE path IN ('. implode (',', $placeholders) .') ORDER BY fit DESC', $ancestors, 0, 1));
}
elseif (!isset($menu[$router_path])) {
// Add an empty path as a fallback.
$ancestors[] = '';
foreach ($ancestors as $key => $router_path) {
if (isset($menu[$router_path])) {
// Exit the loop leaving $router_path as the first match.
break;
}
}
// If we did not find the path, $router_path will be the empty string
// at the end of $ancestors.
}
return $router_path;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии