Add a Menu Type to Joomla Site Part

After the component is installed, you can create a menu Item to access it. This allows to access the component through a menu rather than having to remember what to type into the address bar. Each view and layout can have its own menu item.

The details are stored in the default.xml file located in the tmpl folder.


<?xml version="1.0" encoding="utf-8"?>
<layout title="Hello World Message">
<message>Displays a message</message>

After creating the menu item from the Joomla menu manager, you can check the link that relates to the menu item. Here, you can see the component (like option=com_content), the view (like view=category), the layout (like layout=blog) and the id (like id=4) of the item.

Menu Parameters

You can add form fields. For example,

<fields name="params">
<fieldset name="basic" label="Options">
label="Message" />

The values of these fields are stored as JSON encoded in the params column of the menu database table. To access these parameters, add the following code in the view file:

$app = JFactory::getApplication();
$active = $app->getMenu()->getActive();
$this->params = $active->params;

Now, in the view file or layout file, you can get any parameter:

echo $this->params->get('msg');


Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive