News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

MOD Menu without limit level

Started by davidhs, February 21, 2010, 02:11:50 PM

Previous topic - Next topic

davidhs

Menu without limit level

ACERCA DE...

Menu without limit level, 3.0
Menú superior sin límite de niveles.
© 2010-2021 por davidhs


Esta obra está bajo una licencia de Creative Commons Reconocimiento 3.0 Unported.

DESCRIPCIÓN

Añade la posibilidad de que el menú superior del foro tenga cualquier número de niveles.

Modifica:

  • El código donde se define el menú para permitir cualquier número de niveles.
  • El tema default para que muestre hasta 10 niveles (el menú principal y 9 niveles de submenús), debido al CSS.

Además permite cambiar la estructura del menu en el panel de administración, utilizando código PHP.

EJEMPLO

Para crear este menú,
QuoteMenu multi-level

  • Submenu 1 - level 1

    • Submenu 1.1 - level 2

      • Submenu 1.1.1 - level 3
      • Submenu 1.1.2 - level 3
    • Submenu 1.2 - level 2

      • Submenu 1.2.1 - level 3
      • Submenu 1.2.2 - level 3
    • Submenu 1.3 - level 2
  • Submenu 2 - level 1

    • Submenu 2.1 - level 2
    • Submenu 2.1 - level 2

el código PHP es este:
$buttons2 = $buttons;
$buttons = array();
foreach ($buttons2 as $i => $b)
{
$buttons[$i] = $b;
if ('home' == $i)
{
$buttons['m0'] = array(
'title' => 'Menu multi-level',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm1' => array(
'title' => 'Submenu 1 - level 1',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm11' => array(
'title' => 'Submenu 1.1 - level 2',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm111' => array(
'title' => 'Submenu 1.1.1 - level 3',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm1111' => array(
'title' => 'Submenu 1.1.1.1 - level 4',
'href' => '',
'show' => true,
),
'm1112' => array(
'title' => 'Submenu 1.1.1.2 - level 4',
'href' => '',
'show' => true,
),
),
),
'm112' => array(
'title' => 'Submenu 1.1.2 - level 3',
'href' => '',
'show' => true,
),
),
),

'm12' => array(
'title' => 'Submenu 1.2 - level 2',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm121' => array(
'title' => 'Submenu 1.2.1 - level 3',
'href' => '',
'show' => true,
),
'm122' => array(
'title' => 'Submenu 1.2.2 - level 3',
'href' => '',
'show' => true,
),
),
),

'm13' => array(
'title' => 'Submenu 1.3 - level 2',
'href' => '',
'show' => true,
),
),
),

'm2' => array(
'title' => 'Submenu 2 - level 1',
'href' => '',
'show' => true,
'sub_buttons' => array(
'm21' => array(
'title' => 'Submenu 2.1 - level 2',
'href' => '',
'show' => true,
),
'm22' => array(
'title' => 'Submenu 2.2 - level 2',
'href' => '',
'show' => true,
),
),
),

),
);

}
}


COMPATIBILIDAD SMF


  • SMF 2.0 a 2.0.18.
  • SMF 2.1 Beta 3 y RC1 a RC3.

IDIOMAS


  • english, english_british.
  • spanish_es, spanish_latin.

DESCARGA

Enlace al MOD.

INSTALACIÓN MANUAL

Véase https://wiki.simplemachines.org/smf/Manual_installation_of_mods

COLABORA CON ESTE MOD

Esta obra está bajo una licencia de Creative Commons Reconocimiento 3.0 Unported.

Eres libre de compartir y adaptar este MOD. Además puedes colaborar de diversas formas:

  • Escribir comentarios, detectar errores o sugerir mejoras en los temas de soporte en inglés y en español.
  • Traducir el mod a otros idiomas, añadiendo la traducción en los temas de soporte.
  • Ayudar a ampliar mi colección de monedas, billetes y sellos, enviándome algo de tu país vía correo postal (pídeme la dirección por mensaje privado).
  • Hacer una donación vía PayPal.

REGISTRO DE CAMBIOS

Leyenda:   ! Corregido   + Añadido   - Eliminado   * Cambiado   @ Nota

3.0     17/02/2021
------------------
@ En versiones anteriores el menú se modificaba en un fichero (llamado Subs-MenuWithoutLimitLevel-Menu.php desde la versión 2.0, y con cualquier nombre en versiones anteriores). Ahora el menú se modifica desde el panel de administración. Debe copiar el contenido del fichero en el campo del panel, y eliminar el fichero.
+ Panel de administración.
+ Permite cambiar la estructura del menu en el panel de administración, utilizando código PHP.
+ La Búsqueda Rápida del Centro de Administración SMF busca en las variables de configuración del MOD.
+ SMF compatibility: 2.0.16-2.0.18 y 2.1 RC3.
+ Idiomas: english, english-utf8, english_british, english_british-utf8, spanish_es, spanish_es-utf8, spanish_latin, spanish_latin-utf8.

2.0.1   09/04/2019
------------------
+ Compatibilidad SMF: 2.1 RC1 a RC2.

2.0     20/12/2017
------------------
@ En versiones anteriores eran necesarios cambios manuales en el fichero Sources/Load.php. Ya no son necesarios y deben deshacerse.
@ En versiones anteriores el fichero PHP donde se modifica el menú podía tener cualquier nombre. Ahora tiene que llamarse Subs-MenuWithoutLimitLevel-Menu.php. Si existe con otro nombre debe renombrarse. Y la función tiene que llamarse mwllMenuButtons.
* Utiliza integration hooks.
+ Compatibilidad SMF: 2.0.8-2.0.15 y 2.1 Beta 3.

1.0.11  24/01/2014
------------------
! Error en el código fuente.
+ Compatibilidad SMF: 2.0.7.

1.0.10  24/10/2013
------------------
+ Compatibilidad SMF: 2.0.6.

1.0.9   18/08/2013
------------------
@ Esta obra está bajo una licencia de Creative Commons Reconocimiento 3.0 Unported https://creativecommons.org/licenses/by/3.0/deed.es_ES
+ Compatibilidad SMF: 2.0.5.

1.0.8   09/04/2013
------------------
+ Compatibilidad SMF: 2.0.4.
- Compatibilidad SMF: Soporte a las versiones RC.

1.0.7   22/12/2012
------------------
+ Compatibilidad SMF: 2.0.3.

1.0.6   24/12/2011
------------------
! Algunas modificaciones del index.css del tema no son necesarias.
+ Compatibilidad SMF: 2.0.2.

1.0.5   20/09/2011
------------------
+ Compatibilidad SMF: 2.0.1.

1.0.4   18/06/2011
------------------
+ Compatibilidad SMF: 2.0.

1.0.3   13/02/2011
------------------
+ Compatibilidad SMF: 2.0 RC5.

1.0.2   04/11/2010
------------------
+ Compatibilidad SMF: 2.0 RC4.

1.0.1   10/03/2010
------------------
! En 2.0 RC2, los niveles 4 en adelante se mostraban y ocultaban a la vez.
+ Compatibilidad SMF: 2.0 RC3.

1.0     08/03/2010
------------------
+ Compatibilidad SMF: 2.0 RC2.
+ Temas: default.

arielvissig

Exelente...podrias poder el parse por favor....

Y como se agregan submenus??

Gracias

Mi foro: http://www.compartite.com
VERSION: 2.0 RC3
SIMPLE PORTAL 2.3.1
Theme:Default

Mi otro foro: http://www.temperleyforo.com.ar
VERSION: 1.1.11
AdkPortal
theme: default



VERSION: 2.0 RC3
theme: default

davidhs

¿A qué te refieres con lo del "parse"?

Para añadir submenús edita el Sources/Subs.php donde se define el menú (función setupMenuContext()). Ahora puedes poner 'sub_buttons' => array() hasta cualquier nivel (antes también podías pero solo se mostraba el primer y segundo nivel.

P.ej para crear el menú:

Nivel 0

  • Nivel 1

    • Nivel 1.1

      • Nivel 1.1.1
      • Nivel 1.1.2
    • Nivel 1.2
  • Nivel 2

añade:

'menu0' => array(
'title' => 'Nivel 0',
'href' => '',
'show' => true,
'sub_buttons' => array(
'menu1' => array(
'title' => 'Nivel 1',
'href' => '',
'show' => true,
'sub_buttons' => array(
'menu11' => array(
'title' => 'Nivel 1.1',
'href' => '',
'show' => true,
'sub_buttons' => array(
'menu111' => array(
'title' => 'Nivel 1.1.1',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu112' => array(
'title' => 'Nivel 1.1.2',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
),
),
'menu12' => array(
'title' => 'Nivel 1.2',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
),
),
'menu2' => array(
'title' => 'Nivel 2',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
),
),



arielvissig


Mi foro: http://www.compartite.com
VERSION: 2.0 RC3
SIMPLE PORTAL 2.3.1
Theme:Default

Mi otro foro: http://www.temperleyforo.com.ar
VERSION: 1.1.11
AdkPortal
theme: default



VERSION: 2.0 RC3
theme: default

davidhs

He hecho cambios en el package-info.xml, pero el MOD funciona igual.


Ginolatex

Fantástico, justo andaba buscando algo así!!!!!  ;D

En cuanto se vea el Parse lo pongo es uso.


Saludos.

davidhs

Quote from: Ginolatex on March 09, 2010, 04:32:39 PM
En cuanto se vea el Parse lo pongo es uso.

Si te refieres a la instalación manual, no voy a hacer tutorial por que ya existe uno general en http://docs.simplemachines.org/index.php?topic=402

Ahora admite SMF 2.0 RC3.


davidhs

#11
No sabía que eso era el "parse". No lo hago yo, lo hace la web.

Ginolatex

Ahora si. Muchas gracias a los dos. Como decia, me viene que ni pintado.


Un saludo.

enik


Ginolatex

Alguién me puede enseñar dónde fallo, me funciona si no uso la parte del submenú 331, algo hago mal pero ni idea de que!!!!

'menu0' => array(
'title' => 'Nivel 0',
'href' => '',
'show' => true,
'sub_buttons' => array(
'menu1' => array(
'title' => 'Nivel 1',
'href' => '',
'show' => true,
'sub_buttons' => array(
     'menu11' => array(
'title' => 'Nivel 1.1',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu12' => array(
'title' => 'Nivel 1.2',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu13' => array(
'title' => 'Nivel 1.3',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu14' => array(
'title' => 'Nivel 1.4',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu15' => array(
'title' => 'Nivel 1.5',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu16' => array(
'title' => 'Nivel 1.6',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu17' => array(
'title' => 'Nivel 1.7',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu18' => array(
'title' => 'Nivel 1.8',
'href' => '',
'show' => true,
'sub_buttons' => array(

),
),
),
),
'menu2' => array(
'title' => '2',
'href' => '',
'show' => true,
'sub_buttons' => array(
'menu21' => array(
'title' => '2.1',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu22' => array(
'title' => '2.2',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu23' => array(
'title' => '2.3',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu24' => array(
'title' => '2.4',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu25' => array(
'title' => '2.5',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu26' => array(
'title' => '2.6',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu27' => array(
'title' => '2.7',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu28' => array(
'title' => '2.8',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
),
),
'menu3' => array(
'title' => '3',
'href' => '',
'show' => true,
'sub_buttons' => array(
   'menu31' => array(
'title' => '3.1',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu32' => array(
'title' => '3.2',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu33' => array(
'title' => '3.3',
'href' => '',
'show' => true,
'sub_buttons' => array(
'menu331' => array(
'title' => 'Nivel 3.3.1',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu332' => array(
'title' => 'Nivel 3.3.2',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
),
),
'menu4' => array(
'title' => '4',
'href' => '',
'show' => true,
'sub_buttons' => array(
'menu41' => array(
'title' => '4.1',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu42' => array(
'title' => '4.2',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu43' => array(
'title' => '4.3',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu44' => array(
'title' => '4.4',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu45' => array(
'title' => '4.5',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu46' => array(
'title' => '4.6',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu47' => array(
'title' => '4.7',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
),
),
'menu5' => array(
'title' => '5',
'href' => '',
'show' => true,
'sub_buttons' => array(

),
),
),
),


sin esto de fabula:

                                                                               ),
),
'menu33' => array(
'title' => '3.3',
'href' => '',
'show' => true,
'sub_buttons' => array(
'menu331' => array(
'title' => 'Nivel 3.3.1',
'href' => '',
'show' => true,
'sub_buttons' => array(
),
),
'menu332' => array(
'title' => 'Nivel 3.3.2',
'href' => '',
'show' => true,
'sub_buttons' => array(



Saludos.

davidhs

Quote from: Ginolatex on March 11, 2010, 02:29:57 PM
Alguién me puede enseñar dónde fallo, me funciona si no uso la parte del submenú 331, algo hago mal pero ni idea de que!!!!

Te faltan por cerrar dos paréntesis, entre el nivel 332 y el 4
                           'menu332' => array(
                              'title' => 'Nivel 3.3.2',
                              'href' => '',
                              'show' => true,
                              'sub_buttons' => array(
                              ),),
                              ),
                           ),
                        ),
                     ),
               'menu4' => array(

Ginolatex

Uhh, muchas gracias, si estaba ahí el error, tanto darle vueltas al final me hice un taco.
Repito, muy agradecido por todo por el mod y por la ayuda.


Saludos.

davidhs

Nueva versión:

1.0.2   04/11/2010
------------------
+ Compatibilidad SMF: Añade 2.0 RC4.

enik


davidhs

Nueva versión:

1.0.3   13/02/2011
------------------
+ Compatibilidad SMF: Añade 2.0 RC5.

Advertisement: