Can't see Server Connects, Browser, Query etc in content page

I gather I should be able to see all of the server connects, browser, queries etc from the main page in content pages but I can’t. So, for instance, I’m putting a new masonry component on my content page _trips.php. On my main page (index.php) I have a server connect sc_trip_blogs. When I go to choose the expression sc_trip_blogs (along with the rest of the ones in index.php) is not an option. Similarly, I can’t see the browser component on the dynamic events. Is there something I need to do to make those components show up? Thanks.

Have you added App Connect to you page? Sorry if that comes across as a silly question.

Not silly. I understand why you’re asking but yes, I have that setup in the project setting so it automatically gets added to every page.

you would have to copy those to each page. Or create an include file.

I think that we are missing something. Is your site based on a SPA (single page app), or is it based on individual pages?

I’m trying to switch over to SPA. So I have an index.php file. I created sections in index.php for all the pages and then used the ‘move to include file’ and ‘Content Page’ for each section. I assumed I would be able to have the server connects/browers/queries/variables/etc in the index.php and use them in the content pages but I can’t see them.

May I assume that you have followed Creating Single Page Apps (SPA). If done properly, the components should be included in the main page (template page); the partials (view pages) will automatically pick them up from there.

Yes

Then it should work.

The principle idea is that there is one template file, usually (but not always) called index.html (or some serverside extension like PHP). This template file pulls content (called partials) into it, depending on the navigation link that is chosen. This means that each page that contains a widget, the supporting files are placed in the template file. This is reflected in the code view of each of the partials which should resemble:

As a side note, please elaborate a bit more in future, this will make it easier for us to help you.

Have a Merry Christmas :christmas_tree:

I apologize if I’m not explaining the issue clearly.

I’ve done a simple test page to hopefully make it easy to see the issue. Here’s the main page (test.php)

<!doctype html>

<html>

<head>

<base href="/">

<meta charset="UTF-8">

<title>Untitled Document</title>

<script src="/dmxAppConnect/dmxAppConnect.js"></script>

<script src="/js/jquery-3.3.1.slim.min.js"></script>

<link rel="stylesheet" href="/fontawesome4/css/font-awesome.min.css">

<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<link rel="stylesheet" href="/bootstrap/4/united/bootstrap.min.css">

<link rel="stylesheet" href="/dmxAppConnect/dmxBootstrap4TableGenerator/dmxBootstrap4TableGenerator.css">

<script src="/dmxAppConnect/dmxRouting/dmxRouting.js"></script>

</head>

<body is="dmx-app" id="test">

<div is="dmx-route" path="/test" url="test_inc.php"></div>

<dmx-serverconnect id="sc_paged_trips" url="/dmxConnect/api/Trips/test.php"></dmx-serverconnect>

<script src="/bootstrap/4/js/bootstrap.min.js"></script>

<script src="/bootstrap/4/js/popper.min.js"></script>

</body>

</html>

And here’s the code for the page created (test_inc.php) by selecting ‘Move to Include File’ and ‘Content Page’

<!-- Wappler include head-page="test.php" appconnect="local" is="dmx-app" bootstrap4="united" fontawesome_4="local" jquery_slim_33="local" id="test_page" -->
<div class="container"><table class="table" id="test_table">
		<thead>
			<tr>
				<th>Trip name</th>
			</tr>
		</thead>
		<tbody is="dmx-repeat" dmx-generator="bs4table" dmx-bind:repeat="sc_paged_trips.data.query1" id="tableRepeat1">
			<tr>
				<td dmx-text="trip_name"></td>
			</tr>
		</tbody>
	</table></div>

That bootstrap table works fine because the server include is in the main page, but if I wanted to create a new item based on that server connect it doesn’t come up in the options…

I hope that’s clearer.

Thanks!
Heather

1 Like

I figured it out!! Both the index.php page and the content pages have to have an AppID or it doesn’t work properly!

Now I get…

2 Likes

Good one - we have to improve that indeed or at least make it more clear or automatic.

1 Like