JParameter with params.xml definition file

174 views
Skip to first unread message

FRamonTB

unread,
Aug 11, 2012, 1:37:34 PM8/11/12
to joomla-de...@googlegroups.com
Hello all,

   I'm developing an MVC component and trying to use parameters in front-end. In one view of the component I coded:

   jimport( 'joomla.html.parameter' );
   $paramsdefs = JPATH_COMPONENT.DS.'models'.DS.'itemparams.xml';
   $params = new JParameter($item->params, $paramsdefs);

and it works well doing gets over the $params object. I do 
   $params->get('value','','group');
and it returns the right value. 

The problem is that the method:
   $params->getGroups()
Always return 'false'... I don't know why... 

My itemparams.xml file:
<root>
<params group="group">
<param type="text" name="value" size="10" label="a label:" description="a description" />
</params>
</root>

Any help will be apreciated. Regards: framontb

elin

unread,
Aug 13, 2012, 8:55:31 PM8/13/12
to joomla-de...@googlegroups.com
Is this in 1.5? Because you shouldn't be using DS and you shouldn't be using JParameter if you are in 2.5.

Elin

FRamonTB

unread,
Aug 14, 2012, 11:12:20 AM8/14/12
to joomla-de...@googlegroups.com
Yes, It's in Joomla 2.5 and I'm using DS and JParameter... shouldn't I?

I was trying to follow this doc: http://docs.joomla.org/Component_parameters

What I should use?

Thanks for you help !!!

Regards: framontb

Herman Peeren

unread,
Aug 14, 2012, 1:16:19 PM8/14/12
to joomla-de...@googlegroups.com
Another Wiki article that needs updating: JParameter is deprecated; you should use JForm instead. DS should not be used anymore, for it has become superfluous as PHP handles slashes correctly nowadays, also on Windows.

On the other hand: deprecated means it is still available... So the question in the posting is still valid.What would the answer be?

elin

unread,
Aug 14, 2012, 3:05:08 PM8/14/12
to joomla-de...@googlegroups.com
Still available in 2.5 but won't be in 3 so really I would not use. I'm sorry I can't even remember how to use it.

Elin

Herman Peeren

unread,
Aug 14, 2012, 3:23:58 PM8/14/12
to joomla-de...@googlegroups.com
On Tuesday, 14 August 2012 21:05:08 UTC+2, elin wrote:
Still available in 2.5 but won't be in 3 so really I would not use. I'm sorry I can't even remember how to use it.

True and not the best practice to use deprecated stuff when making something new, but in 2.5 it is still available and 2.5 is a Long Term Support version. So although the best support might be the advice to not use it, I´ll still give it a try:

The "default" attribute is missing in your parm. That might be the cause for  the internal $_xml variable not being an array now.
Try adding default="some default text" to your parm.

FRamonTB

unread,
Aug 14, 2012, 3:25:25 PM8/14/12
to joomla-de...@googlegroups.com
Thanks for your help. I will try with these doc: 


and these:

Herman Peeren

unread,
Aug 14, 2012, 3:29:52 PM8/14/12
to joomla-de...@googlegroups.com

FRamonTB

unread,
Aug 14, 2012, 3:46:43 PM8/14/12
to joomla-de...@googlegroups.com
Thanks !!! This link seems nice. I will read it.

Regards: framontb
Reply all
Reply to author
Forward
0 new messages