Best practice of SC on Server Side Include pages

I am working on a modular web app and using Server Side Include (SSI).

Could someone share the best practice of using Server Connect (SC) on SSI pages? I am running into trouble when I am loading the SSI pages across various head pages. What is the best practice?

Is it:

  • Option A:
    Adding the SC to the main page and the SSI loads it from there?
    What would be the path to the SC? Would it be {{SC}} or {{someID.SC}}?

  • Option B:
    Adding the SC to the SSI page and load it from there.
    What would be the path to the Service Connect? Would it be {{SC}} or {{someID.SC}}?

  • Option C: …?

Also some clarification/documentation on how to indicate hierarchy between main page and SSI pages would be welcome.
For example, how is the main page identified in the code?

With these:
<base href="..."> and meta name="ac:base" content="...">

Or on the SSI page with this:
<!-- Wappler include head-page='main.php' [...] >

Or is there some documentation I’ve missed?

Hey @ant

(That’s my name too!)

I do this all the time (using PHP)… you can put the SC anywhere and the route to it is always {{SC}}.

In the header comment, if you change the name to be your main page (so for me index.php) then all the effects of your css should be visible in Wappler.

I hope that helps!
Antony.

Thanks @Antony that helps a bit indeed!
However I am still struggling to understand the SC across various pages.

Maybe I can reformulate my question:

Is it possible to use a SSI page (that loads data through a server connect) across various head pages (without embedding the server connect on each head page)?

Yes you can copy a server action component from your page and paste it to a SSI include and then include this SSI on the pages you need it.

Thanks @Teodor, that was my thinking as well.

But when he SSI is loaded on a different head page, it tries to find the SC on the head page instead of the “local” SSI page.
When I check with “dmx.app.data” the SC is not found.
How can I ensure that the SSI page loads the SC on that same SSI page instead of looking for it on the head page?

Sorry I am not sure I understand what you are asking exactly. When SSI is used on the page - the code is injected directly there, there are no head pages etc. Are you sure you are not confusing SSI with Content Pages maybe?

Better provide an example of what exactly are you trying to achieve, as your explanation is quite confusing.

Apologies, let me explain what I try to do:

I have a simple overview page where I load various PHP include files (let’s call them modules).

(I’ve generated these modules through the SSI functionality in Wappler, so they have the tag on the top)

These module present data which is loaded through a server connect.

The question is whether it is possible to make these modules independent from the head page. So that I can use these across various head pages.

Hope this clarifies?

You can remove the Wappler comment tags from the top of the include code. These are only needed for proper rendering them in design view. This won’t break the functionality of your site.