by Marc Dechèvre
present slides https://slides.woluweb.be
The Joomla! User Group of New Jersey 2020.08.26
For a more general presentation about Custom Fields, see this presentation : Custom Fields – A step by step tutorial
What about using Joomla Custom Fields to synchronise data from other sources (like open-data in JSON-format for example) ?
One of the great strengths of Joomla is the override system, allowing to easily change the layout of any article/module/…
13 examples of different layouts with the simple Latest News module: https://greendog.fr/experimentations
Thanks to Custom Fields, we can even enrich the layouts. Example with CF for number of guests/beds/bedrooms/bathrooms + host + url + slideshow: https://greendog.fr/riad
Looking for more overrides with source code ?
See https://www.web-eau.net/developpement/joomla-overrides and https://www.j-over.de/de/template-overrides
As we can see, Joomla is very powerful especially when combining Overrides and Custom Fields.
So my next step was to think: if we could feed those Custom Fields automatically from other sources, it would be even more powerful!
It all started with a website where I wanted to fill in my Joomla Custom Field values with data coming from an external source being available in JSON-format.
The source being static (a database with Research articles, namely with Authors, Publications, …) a 'simple’ Content Plugin was made.
With other words, the Custom Fields are left empty… and for the Joomla Articles of a given category, clicking on Save would trigger the plugin and fill in the Custom Field values.
For another project I wanted to use the same plugin.
But there was a big difference in the type of data to retrieve : instead of being 'static’ (Authors, Publications, …) the source would contain 'changing’ informations (for thousands of Institutions: phone number, address, opening hours, …).
So synchronising at the time of Saving our Joomla article was not good enough any more : the idea was to be able to somehow 'trigger’ this synchronisation every X days for example so that we don’t display outdated informations.
To have a preview/demo of how to synchronise your Custom Fields with an external source on a multilingual Joomla website, you can see https://sync.joomlacustomfields.org/fr/
The plugin is freely available on https://github.com/woluweb/updatecf.
Feel free:
Joomla 4 will ship with Webservices so this kind of synchronization will be made even easier. Even two ways!
For example :
So we are really looking forward to Joomla4 🎉
I owe the first version of this plugin to Pascal Leconte (France) https://github.com/pmleconte https://www.conseilgouz.com/, a very active moderator on the Joomla French-speaking forum https://forum.joomla.fr
I am very grateful to him !
Then I decided to publish the plugin on Github for the present Joomla User Group session. And as you know, the Joomla Community is fantastic.
So several persons helped improving the code :
A big shoutout to them as well.
Any suggestion about this presentation ?
Please feel free to contact me. I’ll be happy to keep improving it:)
Marc Dechèvre | woluweb
+32 474 37 13 12 | +32 2 772 58 69