The Joomla! Forum ™



Forum rules


Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
PostPosted: Sat Mar 20, 2010 9:50 pm 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Sat Jan 28, 2006 11:51 pm
Posts: 731
Location: West Kelowna, BC
Hello,

Is it possible to load the language file and component parameters from another component when executing code in another component? For example, I need to add code to component x, which is coming from component y. In the code added to component x it needs to get parameter values and language files from component y.

What code would I use to load the parameters from component y and access component y's language entries when I am executing code in component x?

Any help would be appreciated.

_________________
Laurelle
Keashly.ca Consulting
http://www.keashly.ca


Top
 Profile  
 
PostPosted: Sun Mar 21, 2010 1:21 am 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Tue Jun 09, 2009 2:21 am
Posts: 1964
Location: WV
$otherlanguage =& JFactory::getLanguage();
$otherlanguage->load( 'com_othercomponent', JPATH_SITE );

and

$otherparams =& JComponentHelper::getParams( 'com_othercomponent' );

??

_________________
http://jeffchannell.com - Joomla Extensions & Support
http://biziant.com - Open Joomla Firewall/IDS
Unsolicited private messages/emails = hire me to fix your problem.
καλλιστι


Top
 Profile  
 
PostPosted: Sun Mar 21, 2010 10:03 pm 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Sat Jan 28, 2006 11:51 pm
Posts: 731
Location: West Kelowna, BC
Hello,

Thank you for your help.

Next question, how do I access the component parameters. I tried:
Code:
      $pos_params = & JComponentHelper::getParams('com_posuid');
      return $pos_params->get('e-commerce-detail6');


and this is what is in config.xml for com_posuid:
Code:
   
<param type="text" name="e-commerce-detail6" label="Shopper Group ID" default="5" description="default: 5" class="" cols="3" rows="1"/>


So, I expected that I would get 5 returned, but I am getting nothing returned.

I really appreciate you help.

Thank you.

_________________
Laurelle
Keashly.ca Consulting
http://www.keashly.ca


Top
 Profile  
 
PostPosted: Sun Mar 21, 2010 10:21 pm 
User avatar
Joomla! Ace
Joomla! Ace

Joined: Tue Jun 09, 2009 2:21 am
Posts: 1964
Location: WV
Have you tried defining a default in your return?
Code:
      $pos_params = & JComponentHelper::getParams('com_posuid');
      return $pos_params->get('e-commerce-detail6', 5);


You might also try fetching the params via the menu, as I believe that should have all of the params (including those that are overridden by that menu item).

Another option is to fetch them raw directly from the __components database table and feed them into a new JParameter instance ( http://api.joomla.org/Joomla-Framework/ ... meter.html ).

_________________
http://jeffchannell.com - Joomla Extensions & Support
http://biziant.com - Open Joomla Firewall/IDS
Unsolicited private messages/emails = hire me to fix your problem.
καλλιστι


Top
 Profile  
 
PostPosted: Wed Mar 24, 2010 11:08 pm 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Sat Jan 28, 2006 11:51 pm
Posts: 731
Location: West Kelowna, BC
Hello,

Once again thank you for your help.

I figured out why I wasn't getting anything returned using:
Code:
$pos_params = & JComponentHelper::getParams('com_posuid');
      return $pos_params->get('e-commerce-detail6');

It was because there was no parameters stored in the component params field yet. Once I saved the Parameters in the backend, then this worked great.

I continue reading the documentation for parameters and it has this statement:
Quote:
Note that there is no need to define default attributes for the <param /> elements in the config.xml file, since the default values will already have been saved in the installation of the Component.

on this page: http://docs.joomla.org/Component_parameters.
Do you have to define the parameters in the config.xml file in the installation file for the component in order for the default values to get saved into the database? Or how do the default attributes get saved in the installation of the component. I obviously have missed something.

Thanks again, you have been so helpful. I really appreciate you taking the time to answer these newbie questions.

_________________
Laurelle
Keashly.ca Consulting
http://www.keashly.ca


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 



Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group