How to create a website with Joomla: How to add menu links?

07/18/2012 16:18

I think you like know more,please read here more now,How to create a website with Joomla: How to add menu links?
How to create a website with Joomla: Links  
In this tutorial we will show you how to link your articles to your menus. After reading this tutorial you will be able to add new items to your menus and expand your website with different sections.
Linking Articles to the Menu

In order to make your pages accessible for your visitors, you should link them in the site menu. To do this, follow the steps below.

Step 1.  From the admin panel, go to Menus -> Main Menu*.

Main Menu

Step 2. Delete all default links. For this purpose check the first radio button to select all links and click on Trash. (There will be a warning "You cannot trash the default menu item" which can be safely disregarded)

Step 3. Let's add links to your articles and the "Contact us" page. For this purpose click on [New] from the top-left menu and select the item type. In our case it will be Internal link - Article - Article Layout:

Internal link - Article - Article Layout

Step 4. Fill in the information about the links. Let's call the link "About us". Then from the left Parameters - Basic click on [Select]:

Parameters - Basic

Step 5. A box with all your pages will appear and you should click on "About us":

About us

Step 6. Save the link by clicking on [Save] from the top-right menu.
How to set a page as default?

While you are still in the Menu Item Manager, let's set your page "About us" as default.

Step 1. For this purpose check its radio button and click on [Default] from the top menu:

About us

Step 2. (Optionally) You can remove the default link "Home" because we will not need it.
How to link to a Category in a Joomla 2.5 Menu

How to add the Contact us page to the menu?

Step 1.  Let's add a link to the "Contact us" page. For this purpose click on the [New] icon from the top menu and choose:Internal Link -> Contacts -> Category -> Standard Contact Layout.

Article - Article Layout
In a previous article, we created a new Category in Joomla 2.5, "Test Category 1". We've also created 3 articles and assigned each one to this new category. What we'd like to do now is link to this category from one of our Joomla 2.5 menus. This will make it easier for visitors to find this category and browse the articles within it.

To create a Category menu item in Joomla 2.5:

    Log into your Joomla Dashboard
    Under Menus, hover over the Menu you would like to add the Category menu item to, and then click Add New Menu Item
    Next to Menu Item Type, click Select
Under Articles, click Category List
Type in a Menu Title. This will be the text that the user clicks on in the menu.
Under Required Settings, Select the Category you would like to link to.
When you created your Joomla category, you may have typed in a description for the category. If you would like to show this description, under Category Options set Category Description to Show.
Click Save & Close. You now have a new menu item that links to your Category!
Before our new Menu Item     After we've added our new Menu Item
before-we-add-a-category-menu-item     after-we-add-a-category-menu-item
I was talking to one of my friend and then during the discussion, we realized that there is no easily available document which can provide quick information how to add menus with their sub menus in the back end of Joomla! for a component at the moment of developing the component and/or afterwards so here is a quick tutorial about this:

A) If you are developing a Joomla! component and wants to have menu & sub menu automatically created with the installation of component then follow below:

1. Please add menu and sub menu details in the back end top bar using below code in the componentname.xml file (Please add similar code with your own details in the administration block of the xml file):

<!--administration files are included here-->


<menu link="option=com_componentname" img="path to icon file">Main Menu Name/Component Name</menu>


<menu view="menuitem1" img="path to icon file">Menu Item 1</menu>

<menu view="menuitem2" img="path to icon file">Menu Item 2</menu>

<menu view="menuitem3" img="path to icon file">Menu Item 3</menu>

<menu view="menuitem4" img="path to icon file">Menu Item 4</menu>

<menu view="menuitem5" img="path to icon file">Menu Item 5</menu>



B) If you are developing a Joomla! component and have not completed the development yet then create menu & sub menus manually using below method – this method is also useful if your component does not have quick links and you want to add them:

Please open your database using phpMyAdmin or any other easy database management tool and then open jos_components table. Please copy the below sql query and change it to meet with your details and run it, it will add menu & sub menus for your component:

INSERT INTO `jos_components` (`id`, `name`, `link`, `menuid`, `parent`,

`admin_menu_link`, `admin_menu_alt`, `option`, `ordering`, `admin_menu_img`,

`iscore`, `params`, `enabled`) VALUES

(1, 'Main Menu Name/Component Name', 'option=com_componentname', 0, 0,

'option= com_componentname', 'Main Menu Name/Component Name',

'com_componentname', 0, 'path to icon file', 0, '', 1),

(2, 'Menu Item 1', '', 0, 1, 'option= com_componentname&view=menuitem1',

'Menu Item 1', 'com_componentname', 2, 'path to icon file', 0, '', 1),

(3, 'Menu Item 2', '', 0, 1, 'option= com_componentname&view=menuitem2',

'Menu Item 2', 'com_componentname', 1, 'path to icon file', 0, '', 1),

(4, 'Menu Item 3', '', 0, 1, 'option= com_componentname&view=menuitem3',

'Menu Item 3', 'com_componentname', 3, 'path to icon file', 0, '', 1),

(5, 'Menu Item 4', '', 0, 1, 'option= com_componentname&view=menuitem4',

'Menu Item 4', 'com_componentname', 4, 'path to icon file', 0, '', 1),

(6, 'Menu Item 5', '', 0, 1, 'option= com_componentname&view=menuitem5',

'Menu Item 5', 'com_componentname', 5, 'path to icon file', 0, '', 1);


1) Entry in the XML file ensures this to be taken care while installing the Joomla Component and then it adds the menu and sub menu at the same time automatically to Joomla! administration menu by making entry into __components DB table
2) Manual entry in the db is required to make it possible as if installation was not done using XML file or you are developing a component but after completion of such component, please make sure to include this in the XML file so that user can do the complete automated installation easily

3) Please note, here path to icon file could be like as below:


Here, it is always useful to put all the icons files in the assets folder of the component which is used to store all the additional files to provide them as needed.
4) Sub menus will be linked as if you enter proper parent Id for them in the above DB table.
5) Please make sure to update corresponding names with your component details.