Revision as of 12:06, 25 June 2016 by Janvankuijk(talk | contribs)(Created page with "Nu veranderen we ons voorbeeld naar het maken van drie verschillende menu's, één voor het hoogste niveau (honden en katten), één voor honden (collies en windhonden), en é...")
This page is tagged because it NEEDS UPDATING. You can help the Joomla! Documentation Wiki by contributing to it. More pages that need help similar to this one are here. NOTE-If you feel the need is satistified, please remove this notice. Reason: 'Needs an update using version 3.x'
In Joomla!, submenu's kunnen worden weergegeven als een menu met twee of meer niveaus of als volledig aparte menu-modules. Om te laten zien hoe je dit doet, zullen we het creëren van een menu met twee niveaus doorlopen en dan laten zien hoe je het toont als een uitgebreid menu of als afzonderlijke bovenliggende en onderliggende menu's.
In ons voorbeeld maken we een menu met de naam "Pets". Het zal twee top-level menu-items hebben genaamd "Dogs" en "Cats". Onder de Dogs, hebben we "Collies" en "Greyhounds". Onder de Cats hebben we "Tabbies" en "Siamese". Dus de structuur van het Pets menu wordt als volgt:
Dogs
Collies
Greyhounds
Cats
Tabbies
Siamese
Menu en menu-items
Om deze structuur te maken, maken we één menu met twee menu-item niveaus. We doen dit voor het maken van één groot menu maar ook als we aparte menu-modules willen creëren (een bovenliggend menu en twee onderliggende menu's). We zullen later zien hoe je dit doet, als we de modules aanmaken.
Hier zijn de stappen voor het maken van het menu en de menu-items.
Maak een nieuw menu in Menu's bij beheren, genaamd "Pets".
Voeg een nieuw menu-item toe genaamd "Dogs". In dit voorbeeld is het niet belangrijk wat het menu-item type is. Je kunt bijvoorbeeld een artikel aanmaken met de naam "Pet Menu Test" en creëer dan alle menu-items met het type ""Artikel → Artikel Lay-out"' en verwijs naar dat artikel.
Voeg een tweede menu-item toe genaamd "Collies" (menu-itemtype als artikel indeling net als boven). In de box hoofd-item, selecteer "Dogs" zoals hieronder. File:Submenu example1-nl.png
Voeg een derde menu-item toe genaamd "Greyhounds", wederom "Dogs" het hoofditem maken. (Deze kunnen allemaal naar hetzelfde artikel verwijzen.)
Voeg het menu-item "Cats" toe. Klik bij Hoofditem "menu-item root" aan.
Voeg de laatste twee menu-items toe, "Tabbies" en "Siamese", waarbij "Cats" het hoofditem is voor beide.
Wanneer je klaar bent, zou de Menu-Item Manager er als volgt uit moeten zien:
Op dit moment hebben we het menu en de menu-items klaar. Nu moeten we de menu modules creëren. In Joomla! bepaalt de menu module drie dingen: (1) hoe het menu eruit ziet; (2) waar op de pagina het te zien is; en (3) op welke pagina's het te zien is.
We zullen twee voorbeelden laten zien.
In het eerste voorbeeld zullen we een menu module aanmaken dat alle items in één menu laat zien. In het tweede voorbeeld zullen we drie afzonderlijke menu modules aanmaken zodat we de Pets, Dogs en Cats menu's als aparte modules laten zien.
Eén menu module
Om het te laten zien als één module, volg deze stappen:
Ga naar Extensies → Modules, klik op het "Nieuw" pictogram in de werkbalk en kies "Menu".
Vul in de titel "Pets Menu" en de positie "links".
In het tabblad Menutoewijzing, kies bij Moduletoewijzing "Alleen op de geselecteerde pagina's" en selecteer "Home" (onder "mainmenu") en alle items onder het "pets-menu".
bij Selecteer Menu, kies het "pets-menu" van de drop-down lijst.
Als je het standaard "rhuk_milkyway" template gebruikt en je wilt dat het menu er net zo uit ziet als de andere menu's, voor dan bij de Geavanceerde instellingen "_menu" bij Module Class Achtervoegsel.
Ga nu naar homepage aan de voorkant van de website. Je zou nu het Pets menu moeten zien zoals hier beneden:
Je kunt nu zien dat het Kruimelpad drie niveaus laat zien: Home, Dogs, Collies. Omdat we submenus hebben gebruikt ziet Joomla! dat Collies onder Dogs valt.
Aparte Menu-Modules
Nu veranderen we ons voorbeeld naar het maken van drie verschillende menu's, één voor het hoogste niveau (honden en katten), één voor honden (collies en windhonden), en één voor katten (cyperse kat en siamees).
Note: Make sure that your Menu Items each have a unique Alias value. If you use the Copy command in the toolbar of the Menu Item Manager to create these Menu Items, the Alias will be the same as the item being copied. In this case, just edit the Alias value to make it unique (for example, the same as the Title). If you have duplicate Alias values, the menus will not work correctly if the parameter SEF URLs is set to Yes in Global Configuration.
To do this:
Open the Pets Menu in the Module Manager and change the Title to "Pets Menu Top Level Only".
Selecteer de Linker Positie.
Under Module Parameters, select the Menu Name "Pets Menu"
Under Module Parameters, change the Menu Style to "List".
Set the Start Level to "0" and the End Level to "1".
This is optional. It allows your template to apply special a menu style to the menu (a border, for example). In Advanced Module Parameters put "_menu" in Module Class Suffix.
For submenu Dog, in extensions menu select Module Manager, click New and select Menu, and set the title to "Dogs Submenu".
Set the Position to "Left".
Now this part is very important. We only want this submenu to show when we are in one of the Dogs Menu Items. So, in the Menu Assignment box, select the three items "Dogs", "Collies", and "Greyhounds", as shown below:
Under Module Parameters, select the menu name "Pets Menu" and change the Menu Style to "List".
Set the Start Level to "1" and End Level "2".
This is optional. In Advanced Module Parameters, set Module Class Suffix to "_menu".
For the "Cats Submenu", repeat steps from 7 to 12 except step 9. In the Menu Assignment box, select the items "Cat", "Tabbies" and "Siamese" (so this menu will only show under these Menu Items).
At this point, we have three menu modules all pointing to the Pets Menu. The only differences between them are (1) the Start and End Levels and (2) the Menu Item Assignment.
Now, in the front end, navigate to the Home page. The "Pets Menu Top Level Only" menu should show. Select the "Dogs" Menu Item. Now, the "Dogs Submenu" should show as a separate menu, as shown below:
Click on the Collies Menu Item and notice that again the Breadcrumbs shows the hierarchy of "Home", "Dogs", and "Collies".
Using this same technique, it is easy to create third-level submenus. You just make the Parent Menu Item a second-level submenu. Then you could use the same technique to create a separate Menu Module with Start Level of 2 and End Level of 3. This would show only the third-level Menu Items.