This was definitely useful. I was using all sorts of example code shown in re of 1.6 that showed the use of the new xml layout with fieldsets, fields and field tags and where it showed to use "basic" (ie. <fields name="basic">), was a part of the issue. When I saw your post - which gave me enough of a clue along with the var_dump output, I changed my code to use a path of data.params.myparameter and changed my config.xml file to dump the word "basic" in lieu of "params" and got working results. I still think this is not really the right way to get the parameters but it is now working and I have to move onward... There must be a proper way to do this and it would be nice to know what it is.
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<config>
<fields addfieldpath="administrator/components/com_XXXXXXX"/>
<fieldset name="params" label="Component Parameters" description="Component Parameters Description">
<fields name="params">
<field name="basedir" type="text" size="40" default="images/EventMedia" label="Base Folder" description="The path within the webroot to the media base folder."/>
<field name="catfile" type="text" size="40" default="category_data.txt" label="Category Filename" description="The name to use for the category data file."/>
<field name="eventfile" type="text" size="40" default="event_data.txt" label="Event Filename" description="The name to use for the event data file." />
</fields>
</fieldset>
</config>
With the above xml file, in the front end component code, I can now get the value of the parameters like what follows:
Code: Select all
$app = JFactory::getApplication('site');
$params = &JComponentHelper::getParams('com_XXXXXX');
$baseDir = $params->getValue('data.params.basedir');
$catFile = $params->getValue('data.params.catfile');
$eventFile = $params->getValue('data.params.eventfile');