No Code Attached Yet
avatar cheetabhai
cheetabhai
19 May 2022

Steps to reproduce the issue

  1. Enable "Content - Load Modules" plugin
  2. Add {loadmoduleid YOUR_MODULE_ID} multiple times in an article
    NOTE:- I have a use case where my module content changes each time the module is loaded on the page e.g I am showing Ads in the module

Expected result

The module content of all the module instances in the article is always the same as the content rendered by the first instance of the module.

Actual result

Each instance of the module in the article should be rendered separately

System information (as much as possible)

Joomla 4.1.3
PHP 8.1
System Cache is OFF

Additional comments

This is working as expected in Joomla 3.X but not working in Joomla 4.X

The issue is due to the code in the file on the path given below

JOOMLA/libraries/src/Helper/ModuleHelper.php => Function renderRawModule()

if (!empty($module->contentRendered)) { return $module->content; }

avatar cheetabhai cheetabhai - open - 19 May 2022
avatar joomla-cms-bot joomla-cms-bot - change - 19 May 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 19 May 2022
avatar cheetabhai cheetabhai - change - 19 May 2022
Title
[4.1.3] If a module is loaded multiple times in an article using {loadmoduleid XX} then the module content is cached for repeting instances
[4.1.3] If a module is loaded multiple times in an article using {loadmoduleid XX} then the module content is cached for repeating instances
avatar cheetabhai cheetabhai - edited - 19 May 2022
avatar cheetabhai cheetabhai - change - 19 May 2022
The description was changed
avatar cheetabhai cheetabhai - edited - 19 May 2022
avatar Fedik
Fedik - comment - 19 May 2022

The module content of all the module instances in the article is always the same as the content rendered by the first instance of the module.

This is correct behavior for Joomla 4.
The module with the same ID will produce the same result (it actualy cached on initial call).

I have a use case where my module content changes each time the module is loaded on the page e.g I am showing Ads in the module

It probably better to use multiple module instances.
Also can be own Content plugin instead of module.

avatar richard67
richard67 - comment - 19 May 2022

So this issue can be closed as expected behavior?

avatar cheetabhai
cheetabhai - comment - 20 May 2022

The module with the same ID will produce the same result (it actualy cached on initial call).
@Fedik This is expected behavior and is good to improve the performance but ideally the output should not be cached if the cache is disabled in Joomla global configuration.

Add a Comment

Login with GitHub to post a comment