A search result, a page of a list, a counter: a part of a page that the browser wants to refresh on its own. {fragment 'name'}...{/fragment} names such a part. A normal request renders the whole page, the fragment in its place:

PHP
HTML
fragments/response_fragments_1.pad
Result
<h4>Orders</h4>

{fragment 'order-list'}
<ul>
{sequence '101..103', name='number'}<li>Order {$number}</li>{/sequence}
</ul>
{/fragment}

<p>The page goes on here.</p>

Orders

  • Order 101
  • Order 102
  • Order 103

The page goes on here.

A request that adds &padFragment=order-list to the URL gets that fragment and nothing else - the same template serves the full page and the update:

PHP
HTML
fragments/response_fragments_2.pad
Result
{curl 'SELF://manual/?fragments/response_fragments_1&padInclude&padFragment=order-list'}
  • Order 101
  • Order 102
  • Order 103

How it works

With ajax and HTMX