create-prisma-php-app 1.8.17 → 1.8.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -222,18 +222,33 @@ try {
222
222
  $contentToInclude = $result['path'] ?? '';
223
223
  $layoutsToInclude = $result['layouts'] ?? [];
224
224
  $pathname = $result['uri'] ? "/" . $result['uri'] : "/";
225
+ if (!empty($layoutsToInclude))
226
+ $isParentLayout = strpos($layoutsToInclude[0], 'src/app/layout.php') !== false;
227
+ else
228
+ $isParentLayout = false;
225
229
 
230
+ ob_start();
226
231
  if (!empty($contentToInclude)) {
227
- foreach ($layoutsToInclude as $layoutPath) {
232
+ if (!$isParentLayout) {
233
+ require_once $contentToInclude;
234
+ }
235
+ $childContent = ob_get_clean();
236
+ for ($i = count($layoutsToInclude) - 1; $i >= 0; $i--) {
237
+ $layoutPath = $layoutsToInclude[$i];
238
+ ob_start();
228
239
  require_once $layoutPath;
240
+ $childContent = ob_get_clean();
229
241
  }
230
242
 
231
- require_once $contentToInclude;
243
+ if ($isParentLayout) {
244
+ require_once $contentToInclude;
245
+ }
246
+ $content = $childContent;
232
247
  } else {
233
- require_once "not-found.php";
248
+ require_once 'not-found.php';
249
+ $notFound = ob_get_clean();
234
250
  }
251
+ $content .= ob_get_clean();
235
252
  } catch (Throwable $e) {
236
253
  echo "<div class='error'>An error occurred: " . $e->getMessage() . "</div>";
237
254
  }
238
-
239
- $content = ob_get_clean();
@@ -15,6 +15,13 @@
15
15
  </head>
16
16
 
17
17
  <body>
18
+ <!-- don't place any HTML content here. This section is reserved to show the notFound content. -->
19
+ <?php if (isset($notFound)) {
20
+ echo $notFound;
21
+ exit;
22
+ } ?>
23
+
24
+ <!-- Additional HTML content can go here. -->
18
25
  <?php echo $content; ?>
19
26
  <!-- Additional HTML content can go here. -->
20
27
  </body>
@@ -5,7 +5,7 @@
5
5
  Sorry, we couldn't find the page you're looking for.
6
6
  </p>
7
7
  </div>
8
- <a class="inline-flex h-10 items-center justify-center rounded-md border border-gray-200 bg-white px-8 text-sm font-medium shadow-sm transition-colors hover:bg-gray-100 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-gray-950 disabled:pointer-events-none disabled:opacity-50 dark:border-gray-800 dark:bg-gray-950 dark:hover:bg-gray-800 dark:hover:text-gray-50 dark:focus-visible:ring-gray-300" href="#">
8
+ <a class="inline-flex h-10 items-center justify-center rounded-md border border-gray-200 bg-white px-8 text-sm font-medium shadow-sm transition-colors hover:bg-gray-100 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-gray-950 disabled:pointer-events-none disabled:opacity-50 dark:border-gray-800 dark:bg-gray-950 dark:hover:bg-gray-800 dark:hover:text-gray-50 dark:focus-visible:ring-gray-300" href="/">
9
9
  Go to Homepage
10
10
  </a>
11
11
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "1.8.17",
3
+ "version": "1.8.19",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",