Search
Other Sourcerer questions
Forum

Page using Sourcerer fails after update to J4

Steve Goodwin's Avatar Steve Goodwin
I've updated a site to J4 (and updated Sourcerer to the latest J4 version!).
I have an article which contains the lines:
{source js="sg-custom-code/sg-whats-on.js"}{/source}
{source php="sg-custom-code/sg-MemDbConnect.php"}{/source}
{source php="sg-custom-code/sg-whats-on.php"}{/source}

This worked fine with J3 but fails with J4 as the first included .js file cannot find jQuery.

Looking at the page source of both J3 and j4 versions, on J3, jQuery is included BEFORE the Sourcerer .js file but in J4, the Sourcerer file is included before jQuery is loaded.

Any idea how to fix this?
Thanks
Peter van Westen's Avatar Peter van Westen ADMIN
That's not really a Sourcerer issue. That is just down to the order scripts are requested.
If you require jquery for your scripts, then make sure it is requested first.

You could do something like this:
{source}<?php JHtml::_('jquery.framework'); ?>{/source}
{source js="sg-custom-code/sg-whats-on.js"}{/source}
{source php="sg-custom-code/sg-MemDbConnect.php"}{/source}
{source php="sg-custom-code/sg-whats-on.php"}{/source}
Please post a rating at the Joomla! Extensions Directory
Steve Goodwin's Avatar Steve Goodwin
Many thanks for your help.
Now fixed.
Steve
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription