13
Well, the above does not work with blocks :(
When block is cached the block file will not be included and there is no way of pushing js and css.
Other solution I'm working now is callback functions .declared in xoops_version.php
example:
$modversion['onCache']['file'] = "include/functions.php";
$modversion['onCache']['func'] = "publisher_onCache";
So everytime XOOPS hit a page cache or a block cache, it will call a module function.
This seems to work fine!
Imagine a module that has 3 pages and uses 3 different scripts
page 1 -> script 1
page 2 -> script 2
page 3 -> script 3
block1 -> script 1
There is no need to load script 1,2,3 for page one. I can use xoTheme in each page to assign the desired script as we usually do.(no changes needed for existing modules)
However, when module is cached it will not load any of this scripts and it will call this "onCache" function.
In this function I can use $xoTheme but I will have to load the 3 scripts because I'm not aware of the page I am at the moment.
Results when using cache:
page 1 -> script 1,2,3
page 2 -> script 1,2,3
page 3 -> script 1,2,3
block1 -> script 1,2,3
What do you think of this solution?