JComponentHelper::getParam problem.

Locked
nvinvi
Joomla! Intern
Joomla! Intern
Posts: 65
Joined: Sun May 07, 2006 5:04 pm
Location: France

JComponentHelper::getParam problem.

Post by nvinvi » Thu Feb 21, 2008 1:47 pm

with the standard 1.5.1 release
when displaying an article (com_content/view/article/view_html.php)

with
$params =& $mainframe->getParams('com_content');
or $params =& JComponentHelper::getParams('com_content');
that must have the same effect !

I get that :
print_r($params);


JParameter Object ( [_raw] => show_noauth=0 show_title=1 link_titles=0 show_intro=1 show_section=0 link_section=0 show_category=0 link_category=0 show_author=1 show_create_date=1 show_modify_date=1 show_item_navigation=0 show_readmore=1 show_vote=0 show_icons=1 show_pdf_icon=1 show_print_icon=1 show_email_icon=1 show_hits=1 feed_summary=0 [_xml] => [_elements] => Array ( ) [_elementPath] => Array ( [0] => X:\usr2\dev\joomla_150\libraries\joomla\html\parameter\element ) [_defaultNameSpace] => _default [_registry] => Array ( [_default] => Array ( [data] => stdClass Object ( [show_noauth] => 0 [show_title] => 1 [link_titles] => 0 [show_intro] => 1 [show_section] => 0 [link_section] => 0 [show_category] => 0 [link_category] => 0 [show_author] => 1 [show_create_date] => 1 [show_modify_date] => 1 [show_item_navigation] => 0 [show_readmore] => 1 [show_vote] => 0 [show_icons] => 1 [show_pdf_icon] => 0 [show_print_icon] => 0 [show_email_icon] => 0 [show_hits] => 1 [feed_summary] => 0 [show_description] => 0 [show_description_image] => 0 [num_leading_articles] => 1 [num_intro_articles] => 4 [num_columns] => 2 [num_links] => 4 [show_pagination] => 2 [show_pagination_results] => 1 [show_feed_link] => 1 [page_title] => The News [show_page_title] => 1 [menu_image] => -1 [secure] => 0 [page_description] => Joomla! - le portail dynamique et système de gestion de contenu ) ) ) [_errors] => Array ( ) )

value are overwritten by the menu parameters.
For me it's a bug that I have often signalled without anwer.
JComponentHelper::getParams MUST RETURN ONLY COMPONENTS LEVEL PARAMETERS

If its not a bug please explain how to do what i explain in my previous post.
see my last post :in general forum.
http://forum.joomla.org/viewtopic.php?f=428&t=265059

other things on parameters aspects :

why "show_vote", "show_icons" parameters are not in administrator/components/com_content/models/article.xml ?

User avatar
downunder
Joomla! Intern
Joomla! Intern
Posts: 83
Joined: Sat Aug 20, 2005 9:56 am
Location: Gaven (QLD) Australia

Re: JComponentHelper::getParam problem.

Post by downunder » Thu Sep 18, 2008 12:11 am

I had a similar problem. It appears that every time you link a Menu to your component, the XML configuration parameters are written into the menu parameters. Not sure why.
My problem arose from the fact that I renamed some of the parameters in the xml file, and then I was getting two similar scripts looking at the same parameter in the xml config file, and returning different results.

In my situation I simply cleared the parameters in the menu items and all was well.

I agree this needs to be looked at, but maybe not so aggressively.

Hope this helps.
Never doubt that a small group of thoughtful, committed citizens can change the world. Indeed, it's the only thing that ever has... Margaret Mead

qson
Joomla! Intern
Joomla! Intern
Posts: 84
Joined: Sun Mar 05, 2006 9:02 pm

Re: JComponentHelper::getParam problem.

Post by qson » Mon Jan 12, 2009 8:35 pm

Checkout the wiki !
http://docs.joomla.org/Component_parameters wrote:The following code will access the Component-wide default parameters, already overridden with those for the menu item (if applicable):

Code: Select all

<?php
  $params = &JComponentHelper::getParams( 'COMPONENT_NAME' );
 
  // e.g. for the com_weblinks component, you would use:
  // $params = &JComponentHelper::getParams( 'com_weblinks' )
?>
...
You can access the Component-wide default parameter values, without the menu overrides, as follows:

Code: Select all

<?php
  $component = JComponentHelper::getComponent( 'COMPONENT_NAME' );
  $params = new JParameter( $component->params );
?>
Good Luck !


Locked

Return to “Third Party Testing for Joomla! 1.5”