This website uses cookies to improve your experience and deliver relevant information.

on Monday, 08 May 2017

Top tip: Mautic forms not firing in Joomla articles?

This morning we tripped over a problem on our site which had been present for some time.  When we used the Mautic plugin for Joomla on our articles, sometimes the form would not load, and just the mautic short code was left.

It had been flagged as an issue before, but we got around it with direct javascript embeds due to time constraints.  We now needed to use dynamic content and gated videos, and therefore wanted to have the plugin working properly to do that effectively!

After a bit of troubleshooting, it turned out that the reason behind this was quite simple - in our template overrides for article pages, we were using the following variables to render the intro text and full text of an article:

$this->item->introtext
$this->item->fulltext

We render these separately for styling purposes.

The problem occurs because unlike using the alternative route of 

$this->item->text

The former do not automatically fire the content plugins - and hence the Mautic plugin doesn't get triggered.

What we found we needed to do was to add the following:

JHtml::_('content.prepare',$this->item->introtext)

or in the case of full text:

JHtml::_('content.prepare',$this->item->fulltext)

in order for our content plugins to be fired on article pages.

As soon as we implemented this, the content plugins were able to fire on these article layouts, and our Mautic forms and dynamic content started to be rendered!

Hopefully this might save other developers much head scratching and chin rubbing!

 

Need Marketing or SEO support for your project? Work with the experts today!

Virya Group provides a range of solutions to your technology needs