1 minute reading time (195 words)

Adding a parameter to Joomla component's menu item is as easy as pie!

Adding a parameter to Joomla component's menu item is as easy as pie!

Hey Guys,
In this blog we are going to see how to add a parameter to a Joomla component's menu item. This parameter can be used while referring view level in Joomla 2.5.x or 3.x.
Following are the steps to achieve this.

Step 1:

You have to specify parameter / option in your_layout.xml file in your component.
Lets say, you have to add “pageLimit” parameter to default layout of a view named 'products'. For menu item, you have to create add default.xml for this layout and have to add parameter entry as given below.

a. Add a xml file at location

site/components/com_yourcomponent/views/products/tmpl/default.xml

b. Add following code in above xml file



    
         
    
 
    
    
 
    
        All Products
        All Products View 
    

 

After adding the file, this parameter will be displayed while creating menu item for products view. Refer the following screen-shot for this.

b2ap3_thumbnail_menu_parameter.png

Step 2 :

How to get menu parameter or options to use in queries?

// Getting menu Param
$menuParam = JFactory::getApplication()->getParams();
$pageLimit = $menuParam->get(pageLimit, 10);

 

 Using above code you can get menu parameter / option and can use it accordingly.

I hope this will help you. If there are any questions, feel free to add a comment. :)

9
Invitex 2.9 is here with Easysocial Apps and Plent...
Support Closure and Diwali Discounts

Related Posts