pp-loading-content

Prisma PHP

This attribute marks a specific DOM element as the injection target for loading screens. Instead of replacing the entire page body during navigation, only the inner HTML of this element is swapped.

The Injection Target

Without this attribute

By default, when Prisma PHP fetches a loading.php file, it attempts to replace the entire <body> contents.

Result: Your Sidebar, Header, and Navigation disappear immediately, causing a jarring "full page flicker."

With this attribute

The engine finds the element marked with pp-loading-content and injects the loading HTML inside it.

Result: Your Sidebar and Header remain visible and static. Only the main content area shows the loader.

Implementation

Add the attribute to your main content wrapper in your layout file (usually layout.php).

1
2
3
4
5
6
7
8
9
10
11
<?php use PP\MainLayout; ?>
<div class="flex h-screen">
<!-- Static Sidebar (Will NOT flicker) -->
<Sidebar />
<main
class="flex-1 p-6 overflow-y-auto"
pp-loading-content="true" // <-- Injection Target
>
<?= MainLayout::$children; ?>
</main>
</div>

Related Customization

You can control the animation speed of this injection using the sibling attribute:

pp-loading-transition="{'fadeIn': 100, 'fadeOut': 200}"
See loading.php docs