jpganz18
jpganz18

Reputation: 5878

how can I add menu item specific parameters and read them on joomla 2.5 menu?

I am programming a little on joomla(2.5) and I created a component, which works great, now I found a problem... I need that component to receive a paramenter (from a joomla's menu) and indicate a value, then with that value I will calculate some stuffs (like a module's parameter).

So, after searching I found this doc

http://docs.joomla.org/Component_parameters

Which is great (if would work at all), but I have a problem.. I can not add any parameter, I copied and pasted the code for the XML where I should set my parameter field ... and doesnt work, I tried with the fields Ive used for modules, and it does appear, but I cant read them...

Any idea how to do it?

Here is my xml.

<metadata>
  <state>
    <params>
    <param name="mytextvalue" type="text" default="Some text" label="Enter some text" description="" size="10" />
    </params>
  </state>
</metadata>

please help

Upvotes: 2

Views: 2055

Answers (2)

Lodder
Lodder

Reputation: 19743

Create a file called config.xml and add this in:

<?xml version="1.0" encoding="utf-8"?>
<config>
    <fieldset name="settings" label="Configuration Settings" description="Description Goes Here">
        <field name="mytextvalue" type="text" default="Some text" label="Enter some text" description="" size="10" />       
    </fieldset>
</config>

To view the parameters, add JToolBarHelper::preferences('com_yourcomponentname'); to the display function in the view.html.php file. This will add a buttons called "Options" on the Toolbar of your component in the backend. Click it to view the parameters.

Upvotes: 1

Irfan
Irfan

Reputation: 7059

Params are removed from 1.6 and above joomla versions.So you'll have to use fieldset and field instead. About Different Fields

May this will be helpful to you- How to creat new options to joomla component when creating new menu item

Upvotes: 2

Related Questions