Page 1 of 1

CM to PI

Posted: Mon May 12, 2025 6:44 pm
by BatteryTrader
Is there a guide to change a Content module into a PI module, tried a few times, I know there is not a lot of differences, but not there yet.

David

Re: CM to PI

Posted: Mon May 12, 2025 9:10 pm
by Kofod95
Haven't seen a guide, but what I usually do is:
1) take a PI-module (usually, I use model)
2) rename class and constants to match your new module
3) copy whatever from the cm-module needed - often most of the execute function, save for the last bit and the function itself.
The last bit is:

Code: Select all

$tpl_data = [ 'group' => $this->group, 'file' => __FILE__ ];
      include 'includes/modules/content/cm_template.php';
4) paste it into the get_output() function in your new PI-module.
5) Make sure the template-file is referring the right variable
6) Make sure your language-files have the new constants

I think that's about it.

//Daniel

Re: CM to PI

Posted: Mon May 12, 2025 10:00 pm
by burt
Before re-inventing the wheel, check if the PI module you are trying to make already exists.
There are -loads- in the Addon area, some free, some not, some for PRO members (which you have access to).

Re: CM to PI

Posted: Wed May 14, 2025 5:47 am
by BatteryTrader
Yes I checked first, want to play with the advert carousel in the pi modular layout.

Regards