2011-07-03, 04:13:01
Ok. You hava a point in there, but that does not fix my problem.
Maby there shoud be another tag, "display in topmenu" and function that shows every page that has menuStatus = Y
For my purpose I've made that:
And modyfied: get_i18n_link():
This function displays and sort menu items. modyfication of get_i18n_link allows to show page menu name (if any) or shows page title (old behavior).
Maby there shoud be another tag, "display in topmenu" and function that shows every page that has menuStatus = Y
For my purpose I've made that:
Code:
function get_i18n_topmenu(){
// Wyświetla menu z całej strony i sortuje je według kolejności pojawienia na liście w backendzie
$children = return_i18n_pages();
foreach ($children as $child){
if ( isset($child ['menuStatus']) && $child ['menuStatus'] == 'Y'){
$dane[] = array('url' => $child ['url'], 'order' => $child['menuOrder']);
}
}
// Zmiana kolumn na wiersze dla funkcji array_multisort();
foreach ($dane as $klucz => $wiersz){
$url[$klucz] = $wiersz['url'];
$order[$klucz] = $wiersz['order'];
}
array_multisort($order, SORT_ASC,$dane);
// Stworzenie posortowanego menu
foreach ($dane as $slug){
echo '<li>';
get_i18n_link($slug['url']);
echo '</li>';
}
}
And modyfied: get_i18n_link():
Code:
function get_i18n_link($slug) {
$data = return_i18n_page_data($slug);
[b] if ($data->menu == '')
$url_name = $data->title;
else
$url_name = $data->menu;[/b]
if (!$data) return false;
echo '<a href="'.find_url($slug,(string) $data->parent).'">'.stripslashes((string) [b]$url_name[/b]).'</a>';
return true;
}
This function displays and sort menu items. modyfication of get_i18n_link allows to show page menu name (if any) or shows page title (old behavior).