I have a component that calls a module with
< ?php
$modules = JModuleHelper::getModules('modulename');
foreach ($modules as $module) {
echo JModuleHelper::renderModule($module);
}
? >
This is called multiple times inside a foreach statement, however I noticed that if I put a rand() or microtime() inside the module it seems like it's only executed once and then copied over to the other calls (like a cache?). Why is that? I need unique ids inside that module. Is there a way to override this and force a different content for every module rendering?
It could depend on the cache or on the module's implementation.
At the global level, you can disable caching in the global configuration; or you can prevent cache from being used in the individual module's configuration.
You should set cache to "conservative", not progressive, as the latter could indeed mess up copies of the same module on a single page.
Finally, cache is implemented in the module code, so it is ultimately functioning on the assumption that all developers implement all cache strategies correctly; which is true for most extensions, but not all.