• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: How to display PHP variable in description-field

How to display PHP variable in description-field 11 years 4 months ago #26057

I want to display PHP variable from the database in the description of an inputfield. With your documentation, i was able to display the value as default in the inputfield. How can I do this for the description-field?

Many thanks, great component!
Last Edit: 11 years 4 months ago by nicolai.klohk.
The administrator has disabled public write access.

How to display PHP variable in description-field 11 years 4 months ago #26073

I found a solution. Make a placeholder {description} for the descriptionfield. Go to "Script called on form display". There put your DB-Query, attache it to the global variable $formLayout. With the str_replace function you can change the value of the placeholder.

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('Column1', 'Column2')));
$query->from($db->quoteName('yourtable'));
$db->setQuery($query);
$row = $db->loadRowList();

$formLayout = str_replace('{description}', $row ,$formLayout);

You can also use it for the global variable $adminEmail, go to "Script called before the Admin Email is sent".
$adminEmail = str_replace('{description}', $row ,$adminEmail);
Last Edit: 11 years 4 months ago by nicolai.klohk.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!