Workflow for developing PHP include modules

I am developing modules (independent pages with certain basic functionalities) that I would like to include in a main page with PHP include.

When I design the modules as independent pages, I am adding the appconnect + specific serverconnect elements to design and test.

When I include these modules in the main page with an PHP include, the appconnect etc. get loaded twice.

One solution would be to delete the appconnect and server connects elements from the module page and paste them in the main page.
However, if I want to update or modify the module page, I need to copy these elements back in to see, edit and test the module.

Is there a better way to do this?

The best way is to create the module in the relevant page, after which it can be turned into an include as per

Thanks @ben, yes that works, but only one way.

Turning the module into an include makes editing it independently challenging because it misses the serverconnect, css, etc. which have all been copied to the main page.

I see Wappler adds a clause at the top in the module page, after the including process:

<!-- Wappler include head-page="mainpage.php" appConnect="local" is="dmx-app" bootstrap4="cdn" fontawesome_4="cdn" jquery_slim_33="local" -->

but for some reason that doesn’t work and doesn’t seem to include the various serverconnects that the module is making use of.

Am I missing something?

That is the way that it is supposed to work. When the file is included, it automatically picks the related files up from the main document.

This is so that you can edit the included file without having to physically include the dependant files.

Try doing this again on a dummy page, it should work.

1 Like

Thanks @ben it works now. Not sure what went wrong the first time.