’Menus’ - a menu builder/manager plugin for SPIP

For whoever is not using the ’Menus’ plugin, webmasters has to manage all website’s menus, having them hand-coded in the templates, leaving website admins & writers unable to edit them, and forced to multiple support requests, each time they need a menu entry created/modified somewhere.
Besides, when you need to add static links (to any specific or external web page), aside from any SPIP request, you have to code their full html into the menu template file.

This ’Menus’ plugin aims to let you easily create and manage website’s menus, in a fancy user-friendly interface, directly within the admin area.

Are you new to SPIP ?
SPIP is a modern, collaborative and multilingual PHP publishing system and web development framework.
See : spip.net

Attention ! This plugin does NOT actually process any design or styling. It just lets you easily build menus and generates their HTML display.

For everything related to menu styles, check your templates out or see some dedicated (and compliant) plugins, such as

How to install ’Menus’ plugin

Download the ZIP package and upload its content into your plugins/ directory. Then you’ll have to enable it in the admin area : Configuration > Manage plugins.
Read more on how to install a plugin for SPIP

You should also have the Bonux for SPIP 3.* plugin installed & enabled.

How to create a new menu ?

The plugin adds a new entry in the SPIP admin menu : Templates > Website’s menus

The admin page lists all your menus and lets you create new ones :

First you will have to identify your menu.
Let’s give your menu a title and a mandatory text identifier, which will let you easily call for it wherever you need it (because while coding your templates, it’s hard to know in advance what will a menu’s numeric ID actually be).
Thanks to this identifier, you won’t have to edit your templates multiple times. Besides, you also can provide a CSS class to the first generated UL element. This, letting you style that element, according to any other ’menu display’-related plugins (e.g. specific class to generate specific jQuery effect) ...

You can then start building the menu with your own entries :

Entry types

’Menus’ comes with more than 10 entry types, already offering to build most of common menu types.
Feel free to suggest your own !

Here is a brief description of some available entry types :

This entry creates a link to any chosen URL, with a link text.

SPIP objects

Creates links to any SPIP object (article, section, keyword, ...) or any plugin-induced new object (ex. organisation, contact, ...)

Dynamic sections/articles tree

Displays a tree-menu of any chosen ’root’ section by simply providing it’s ID, and a maximum display level for sub-sections, excluded elements’ ID if any, sort options, ... You can also choose to include articles in the display.

How to edit an entry ?

If you already added a menu, you’ll see its entries as following :

You can then :

  • re-order those entries,
  • delete any of them,
  • change their settings as wished,
  • add sub-level menus to entries allowing them,
  • ...

How to use menus in your website ?

To show a menu on your website, simply add this code in the template of your choice :

#INCLURE{fond=inclure/menu, env, identifiant=<your_menu_identifier>}

You can also easily test your menu, clicking on « see online » button or, accessing https://<your_website_url>/spip.php?menu<MENU_NUM_ID>

How to export menus to another SPIP website ?

Let’s say you’re you are re-organizing all menus on a local working copy of your website. If you wan to report those modifications online, you can export your local menus as a YAML file, that you’ll be able to re-import from your production website [1]

This feature needs YAML V2 plugin for SPIP 3.* installed & enabled :
As soon as it is, a new « export this menu » icon appears.

Save it on your computer

On the destination website, create a new empty menu with the same text identifier (or, if it already exists : delete & replace it). If YAML plugin is enabled, a dialog box offering to choose files should be displayed.

Overwriting menus/<type>.html file types

If, for any reason you need to overwrite a menus/*.html file or even the entire directory, be sure to also copy the XML description files that comes with. The plugin actually needs those files to be in the same directory as the working HTML files.

Notes

[1The 2 SPIP websites should ideally run the same version to avoid any error

Discussion

Aucune discussion

Ajouter un commentaire

Avant de faire part d’un problème sur un plugin X, merci de lire ce qui suit :

  • Désactiver tous les plugins que vous ne voulez pas tester afin de vous assurer que le bug vient bien du plugin X. Cela vous évitera d’écrire sur le forum d’une contribution qui n’est finalement pas en cause.
  • Cherchez et notez les numéros de version de tout ce qui est en place au moment du test :
    • version de SPIP, en bas de la partie privée
    • version du plugin testé et des éventuels plugins nécessités
    • version de PHP (exec=info en partie privée)
    • version de MySQL / SQLite
  • Si votre problème concerne la partie publique de votre site, donnez une URL où le bug est visible, pour que les gens puissent voir par eux-mêmes.
  • En cas de page blanche, merci d’activer l’affichage des erreurs, et d’indiquer ensuite l’erreur qui apparaît.

Merci d’avance pour les personnes qui vous aideront !

Par ailleurs, n’oubliez pas que les contributeurs et contributrices ont une vie en dehors de SPIP.

Qui êtes-vous ?
[Se connecter]

Pour afficher votre trombine avec votre message, enregistrez-la d’abord sur gravatar.com (gratuit et indolore) et n’oubliez pas d’indiquer votre adresse e-mail ici.

Ajoutez votre commentaire ici

Ce champ accepte les raccourcis SPIP {{gras}} {italique} -*liste [texte->url] <quote> <code> et le code HTML <q> <del> <ins>. Pour créer des paragraphes, laissez simplement des lignes vides.

Ajouter un document

Suivre les commentaires : RSS 2.0 | Atom