Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hierarchical Menus
#26
Use this plugin http://get-simple.info/extend/plugin/i18n/69/
Reply
#27
(2020-06-30, 23:33:08)Oleg06 Wrote: Use this plugin http://get-simple.info/extend/plugin/i18n/69/

too complicated, I don't need multi-language, I prefer something simple
Reply
#28
Hello
for those who want to use the hierarchical-menus plugin V1.1 with GetSimple 3.3.16
In the inc folder change the functions.php document by

PHP Code:
<?php
/**
 * General functions used by Hierarchical Menus plugin.
 *
 * (c)2012 mrdragonraaar.com
 */
if (!defined('IN_GS')) { die('you cannot load this page directly.'); }

/**
 * Template function to display hierarchical list of menus.
 * @param $currentpage current page slug
 * @param $display true to echo
 */
function get_hierarchical_navigation($currentpage$display true)
{
    if (
$display)
        echo 
exec_filter('menuitems'menu_html(top_menu_data(), 
        
   $currentpage));
    else
        return 
exec_filter('menuitems'menu_html(top_menu_data(), 
        
   $currentpage));
}

/**
 * Template function to display list of top level menus.
 * @param $currentpage current page slug
 * @param $display true to echo
 */
function get_top_navigation($currentpage$display true)
{
    if (
$display)
        echo 
exec_filter('menuitems'menu_html(top_menu_data(), 
        
   $currentpagefalse));
    else
        return 
exec_filter('menuitems'menu_html(top_menu_data(), 
        
   $currentpagefalse));
}

/**
 * Get array of top level menus.
 * @return array of top level menus
 */
function top_menu_data()
{
    return 
child_menu_data('');
}

/**
 * Template function to display list of child menus.
 * @param $currentpage current page slug
 * @param $display true to echo
 */
function get_child_navigation($currentpage$display true)
{
    if (
$display)
        echo 
exec_filter('menuitems'menu_html(
        
   nav_side_data($currentpage), $currentpagefalse));
    else
        return 
exec_filter('menuitems'menu_html(
        
   nav_side_data($currentpage), $currentpagefalse));
}

/**
 * Get array of child menus.
 * @param $parentslug parent page slug
 * @return array of child menus
 */
function child_menu_data($parentslug)
{
    
$menu_data menu_data();
    
$child_menu_data = array();

    foreach (
$menu_data as $menu)
    {
        if (
$menu['parent_slug'] == $parentslug)
        {
            
$child_menu_data[] = $menu;
        }
    }

    return 
$child_menu_data;
}


function 
nav_side_data($parentslug)
{
  $menu_data menu_data();
  $child_menu_data = array();

  foreach ($menu_data as $menu)
  {
    if ($menu['slug'] == $parentslug)
    {
      $grandparentslug $menu['parent_slug'];
    }
  }

  foreach ($menu_data as $menu)
  {
    if ($menu['parent_slug'] == $parentslug || ($menu['parent_slug'] == $grandparentslug && $menu['parent_slug'] != ''))
    {
      $child_menu_data[] = $menu;
    }
  }
  return($child_menu_data);
}

/**
 * Get menu html.
 * @param $menus menu data
 * @param $currentpage current page slug
 * @param $includechildren true if to include child menus
 * @return menu html
 */
function menu_html($menus$currentpage$includechildren true)
{
    
$menu_html '<ul>';

    foreach (
$menus as $menu)
    {
        if (
$menu['menu_status'] == 'Y')
        {
            
$classes = ($menu['parent_slug'] ? 
            
   $menu['parent_slug'] . ' ' '') . 
            
   $menu['slug'];
            if (
$currentpage == $menu['slug'])
            {
                
$classes 'current ' $classes;
            }

            
$menu_html .= '<li class="' $classes '"><a href="' $menu['url'] . '" title="' encode_quotes(cl($menu['title'])) . '">' strip_decode($menu['menu_text'] ? $menu['menu_text'] : $menu['title']) . '</a>';

            if (
$includechildren)
            {
                
$children child_menu_data($menu['slug']);
                if (!empty(
$children))
                {
                    
$menu_html .= menu_html($children$currentpage);
                }
            }

            
$menu_html .= '</li>';
        }
    }

    
$menu_html .= '</ul>';

    return 
$menu_html;
}

/**
 * Template function to display breadcrumb menu.
 * @param $currentpage current page slug
 * @param $seperator seperator between links (default: bullet)
 * @param $includehome true to include home link
 * @param $display true to echo
 */
function get_breadcrumb_navigation($currentpage$seperator '•'$includehome true$display true)
{
    
$menu_data menu_data();
    
$seperator '&nbsp;&nbsp;' $seperator '&nbsp;&nbsp;';
    
$menu_html '';
    
$parentpage $currentpage;

    while (
$parentpage)
    {
        foreach (
$menu_data as $menu)
        {
            if (
$menu['slug'] == $parentpage)
            {
                if (
$parentpage == $currentpage)
                    
$menu_html strip_decode($menu['title']);
                else
                    
$menu_html '<a class="' $menu['slug'] . '" href="' $menu['url'] . '" title="' encode_quotes(cl($menu['title'])) . '">' strip_decode($menu['title']) . '</a>' $seperator $menu_html;
                
$parentpage $menu['parent_slug'];
                break;
            }
        }
    }

    if (
$includehome)
    {
        
$menu_html '<a class="home" href="' get_site_url(false) . '" title="' i18n_r('hierarchical_menus/HMENU_HOME') . '">' i18n_r('hierarchical_menus/HMENU_HOME') . '</a>' $seperator $menu_html;
    }

    if (
$display)
        echo 
$menu_html;
    else
        return 
$menu_html;
}
?>
Reply
#29
Does anyone know if this plugin can be used to create a simple menu to create a list of children from a particular slug. I would expect the code to be something like this :

get_children('menu1')

tyi
Reply
#30
(2023-02-17, 06:27:08)tibbz Wrote: Does anyone know if this plugin can be used to create a simple menu to create a list of children from a particular slug. I would expect the code to be something like this :

get_children('menu1')

tyi

http://get-simple.info/extend/plugin/multimenu/1334/ try this or i18n navigation
Reply
#31
(2023-02-17, 07:36:51)multicolor Wrote:
(2023-02-17, 06:27:08)tibbz Wrote: Does anyone know if this plugin can be used to create a simple menu to create a list of children from a particular slug. I would expect the code to be something like this :

get_children('menu1')

tyi

http://get-simple.info/extend/plugin/multimenu/1334/ try this or i18n navigation

For the i18n plugin, see http://mvlcek.bplaced.net/get-simple/mul...v-children for how to do it.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply




Users browsing this thread: 2 Guest(s)