App connect and SSI files

The way I have always worked has had the Header and footer with PHP calls, for example when I have a user log in his name and picture is in the header menu, also I am use to build the menu from a CMS so how would I pull those menu items instead of been static.

Playing around with SSI it seems to not allow me to add Dynamic elements to these SSI files, is there any workaround or can this be included?

Why not just use php includes (available in SSI type dropdown)?

That is what i am using

No SSI files are not Dreamweaver specific.

@lsadesl what dynamic content do you mean and did you create the SSI files the Wappler way as stated in the docs?

1 Like

Yes I did but, I just created a nav menu and with wappler I selected it to be included as a php file, this menu was static, but later on the project I have built in the database a table to call and create dynamic menu items, but when I tried to apply this to the header.php file that wappler created as SSI, it seems to be missing the dynamic thunder symbol under any test that is present on the menu.

Also, it says body instead of APP, when I try to tell it this is for APP connect framework it adds a comment on the page:

<!-- Wappler include  appconnect="local" bootstrap4="cdn" jquery_slim_33="cdn"-->

When I try to go to add Data --> server connect --> select server action, the moment I move it to the top and save the page it removes this step.

If I keep it after the menu it still doesn’t show any dynamic options on the text

2 Capture

The real intention is to make the menu a repeat area showing the name added in the database and the url specified, on this test I am trying to add dynamic static items like the urls to social media or user name directly to a static item or nav item.

Dont know if we had the same goal but this is what I do to work with includes having dynamic data inside the include file

  1. Create everything on a page that has all dynamic elements (serverconnect etc) and save it.
  2. Create an includes version. Move only the serverconnect for the specific file in the include file
    Check this

<dmx-serverconnect id="getleftsideimages"url=“dmxConnect/api/frontend/side_images/left_side_images.php”>

<div class="card mb-2" dmx-repeat:repeatleftsideimages="getleftsideimages.data.query1">
                        <a href="#" dmx-bind:href="side_image_link">
                          <!-- Image -->
                          <img class="card-img-top" dmx-bind:src="dyslexia.assets/side_images/{{side_image_file}}" dmx-bind:alt="side_image_file">
                          <!-- Text Content -->
                          <div class="card-body" dmx-hide="side_image_title_gr==''">
                            <h5  style="font-weight:bold; font-size:20px; line-height:22px;" class="card-title" dmx-bind:title="side_image_title_gr" dmx-text="side_image_title_gr"></h5>
                            <p   style="font-weight:bold; font-size:16px;" class="card-text" dmx-text="side_image_descr_gr"></p>
                          </div>
                        </a>
                      </div>

Now just include the above file in your main file. All Appconnect.js files etc should only exist in the main file.

Hope this helps

1 Like

Yes i thought of building it first the point, I see then is if I have edits or If i need to add anything when the files has been exported already to be an SSI file then you can no longer add stuff to it, unless you go back and place it on the main file which makes no sense to me as a work around.

There is another option that I sometimes use.
1.Create an $var=1 in the included file.
2.Then add all necessary code that will allow you to make changes anytime (means all appconnect.js, jquery.js etc)
3. Surround all of the code from step 2 into an if statement
For example
<php if($var==0){code from step2;}?>
4. The also include all of the files of step2 in your main file.

I think you get the point of what is going to happen.

When you load your main file, since the $var=1, unnecessary code won’t be loaded from the file that is incuded.

Hope this could work for you
Thank you

Hey Niko, i am not sure i understand the idea of your suggestion but i think you dont’t understand what the initial issue is.
@lsadesl - let me clarify this please, so - you added a nav into a SSI and you can edit its design, static values etc, but you cannot add dynamic data into the SSI. Is that the issue you are having?

Yes maybe I am wrong

I can add manual stuff, but using wappler nice tools wont allow me for example just to add dynamic text to an item in the nav bar the lighting icon is no longer present from there.

So yes you are correct about the dynamic data into the SSI, that is the issue

Will this be added to Wappler or am I doing something wrong?

Hi George, I just notice the new update to version 1.4.0 this still does not allow me to work with dynamic database include files, can I ask this to be included in the features of Wappler, include files like Side bars, menus and footer, should have the functionality to add database items to them, for example having the latest news on the footer.

Please let us know if this would be available to Wappler

Thank you.

1 Like

Sorry @George seem to have unassigned you accidentally.

I would vote for this!

1 Like

Hi @lsadesl, to be honest I do not really see how this is ever going to work.

Lets look at it like this, you make a page, while you have that page open you go to server connect and make a few server actions. Lets just say you make a query as an example. Those query results or parameters are not available on your page until you physically go and add an App Connect component to make the link back your Server Connect action file.
Once you have added the component in App Connect then you can go and add dynamic data from it to your page or to your navbar if you like.
If you then go and make an SSI file of your navbar only then the code gets moved to the include file and the base file pulls that include file back into it.

If you open your include file only, there is no App Connect component on it the is linking your Server Connect action as that action is still on the base file where it needs to be. So in my opinion I do not see how you are ever going to be able to access the dynamic data unless Wappler manages to add to their comments above the include file another parameter to also link back whatever server actions you may have used.

I suppose I never really expected this to work which might be why I am not terribly disappointed that it does not, the reason why is that if I used my old manual php code system and tried to reproduce a similar system I would have the exact same issue not being able to access the properties of the original base file from the include file all by itself.

The way I get around this is I make one page from start to finish, that is absolutely perfect with all dynamic data linked etc.
Then I make a backup of that page and just always keep it as a non working file.
Then I take the original page and I move what needs to move to include files, if I need to make any changes to the include file itself I open my backup base file, make my alterations, save it, then remake the include files from it, and close the original and choose Don’t Save.

So I suppose all we can do is wait and see if this is possibly somehow achievable in Wappler without doing this, but in my opinion I do not expect them to do it, well not for me anyway, and that is just because i am used to this sort of issue i suppose, as I have been working around this for more than 5 years already in every system I have ever used.

@psweb makes some good points.

I’ll often make minor tweaks to an include file - eg adding extra items to a menu - and it usually requires little effort to make such changes. If it would make it easier to make the changes in a dynamic context, then I’ll just put the include code back into a copy of a parent file temporarily. This is what I’ve always done when using Dreamweaver.

Perhaps there could be a button to reinstate an include file - to put it back into the file from which it was originally exported - might be an answer. Then it could be edited and re-exported. I imagine this would be rather easier than making it possible to edit an include file directly, out of context as it were.

1 Like

@TomD what a brilliant idea, that in my opinion would solve the issue quite nicely, to make it less confusing to the user, if they selected the include code in the app structure and there was a button saying edit original, which in the background does exactly what you describe, then once complete they just hit a button that says editing complete or something and it moves it back.
That is a solution that I think could work the easiest.
Edit: It also means that the user will not have to really have the need to open the include file at all, which would possibly be for the best too.

1 Like