0

I have created a component and need to get a constant value in the component administrator and list the item according to it. I have tried different ways to get the constant value in the 'display()' function in 'view.html.php'. I am expecting the value will be available in the default.php with $this.

I have defined the constant in the configuration.php file, A URL is supposed to define.

define('CONSTANTVALUE', 'the URL string'); 

in the display() function,

 $config = JFactory::getConfig();
 $constantvalue = $config->get('CONSTANTVALUE');
 $this->constantvalue=  $constantvalue;

Seems this is not working.

Then, I have tried

JFactory::getApplication()->get('CONSTANTVALUE');

That also not working.

I have referred to this thread, Joomla 3 - How to get value from configuration file?

How can I get the constant from configuration to component view file?

Adam-KER
  • 67
  • 9
  • If you are doing Joomla development, please join [joomla.se] Stack Exchange. Whenever you have a question that would benefit from the support of volunteers with an intimate understanding of the CMS and its extensions, please post your question on JSE. After you join JSE, I can help you with migrating this question to the more appropriate site. – mickmackusa Oct 18 '20 at 08:22
  • @mickmackusa Thanks, I have created the question on Joomla stack exchange. Please find the thread, https://joomla.stackexchange.com/questions/28581/joomla-3-9-19-get-the-constants-from-global-configuration-in-component-display-f – Adam-KER Oct 19 '20 at 04:16

0 Answers0