0

I'm developing a joomla module, where I want to do some recalculation of the output, if the admin changes a specific module setting. One way to implement this, would be to use an additional table, where the setting since the last call is saved and compared to the current setting. However this means, that I would need an additional table, which does not look elegant and simple to me. So I was wondering if there is a better way to realize this feature?

To make it more clear: The admin can switch between OpenStreetMap and Google Maps. If he changes the field I need to make a search request during the next module call and save the result to the database.
Pseudo-Code Example:

if(changed($params->get('searchprovider')) == true){
$result = searchRequest();
saveResultToDatabase($result);
}
$dbResult = loadResultFromDatabase();
showResult($dbResult);
4
  • I suppose we might need a little more context on the amount of additional data that you intend to work with. On one hand, using #__fields_values is a pre-existing table which was designed to be flexible and store different kinds of data. However, with that flexibility comes a drag on performance -- which becomes noticeable when dealing with large volumes of data. Setting up another db outside of the core db is not a silly option. Please edit your question to offer more specifics about your module.
    – mickmackusa
    Dec 26, 2021 at 21:06
  • @mickmackusa Thanks for your answer, I made an edit. Is there any rule/guideline what to save to #__fields_values?
    – BertBaker
    Dec 27, 2021 at 15:17
  • No. #__fields_values is a dumping ground for any string. There are no "rules" about what values should be stored there.
    – mickmackusa
    Dec 27, 2021 at 20:53
  • #__fields_values is not a "dumping ground". It stores data associated with custom fields managed by Fields component. Don't store random data there.
    – Sharky
    Dec 31, 2021 at 7:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.