Synchronization between Joomla Custom Fields & external sources

by Marc Dechèvre

Woluweb

Marc

present slides https://slides.woluweb.be

The Joomla! User Group of New Jersey 2020.08.26

1 Previous presentation

For a more general presentation about Custom Fields, see this presentation : Custom Fields - A step by step tutorial

https://slides.woluweb.be/cf/cf.reveal

https://joomla.org.au/news-articles/australian-virtual-user-group-events/avjug-august-2020-marc-dechevre-joomla-custom-fields

2 Goal of this presentation

What about using Joomla Custom Fields to synchronise data from other sources (like open-data in JSON-format for example) ?

3 The power of Joomla : Overrides and Custom Fields

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

4 Even more powerful if we can feed the CF automatically

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!

5 How it all started - level 1

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.

6 How it went further - level 2

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.

8 Joomla 4

Joomla 4 will ship with Webservices so this kind of synchronization will be made even easier. Even two ways!

For example : - you will be able to feed directly your website from other websites / apps / softwares - your website itself can easily become a Source for other websites / apps / softwares (content available in JSON-format) - …

So we are really looking forward to Joomla4 🎉

9 Thank you

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 : - Christophe Avonture (Belgium) https://github.com/cavo789 https://www.avonture.be/ - Alexandre Elisé (Martinique) https://github.com/alexandreelise https://alexandre-elise.fr/

A big shoutout to them as well.

10 Get in touch

https://slides.woluweb.be

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

https://www.woluweb.be/contact

https://www.slideshare.net/woluweb