{get}

Fetches another page of the application over HTTP, as a second request, and inserts its output.

Pages and execution Single tags

Syntax

{get 'name'}
{get 'name', $colour = 'red'}

Parameters

page
The page of this application to fetch, as in a URL - 'orders/list'; a clean URL route counts.

Description

{get 'name'} asks the web server for another page of this application and puts what comes back in place of the tag. Unlike {page}, which builds the page inside the current request, this is a real second HTTP request: the page runs in a fresh process, with its own variables, and sees nothing of the page that asked for it.

The page is fetched with &padInclude, so it renders bare - without its _inits.pad/_exits.pad wrappers. Every variable assigned on the tag, {get 'badge', $colour = 'red'}, goes along on the query string, where the other page finds it as a request value. The answer is inserted as a value: its braces are text and are not parsed again.

The fetch goes to the server's own address, never to the host a request names. Under the strict check a page that does not exist is an error before any request is made. Because it costs a round trip, {get} is for the case where the isolation of a separate request is the point; {page} is faster and shares the request. Remote addresses are fetched with {curl}; a stored content block is read with {content:name}.

Examples

Another page, fetched

A second request for a page of this application; its output is inserted as text.

Templateexamples/get/1-fetch.src
<aside>
  {get 'news/latest'}
</aside>

Values on the query string

Variables assigned on the tag become request values of the fetched page.

Templateexamples/get/2-values.src
{get 'reports/summary', $year = 2026, $region = 'north'}
{# fetches ?reports/summary&padInclude&year=2026&region=north #}

See also

  • {page} Renders another page of the application - its PHP and its template - in place of the tag.
  • {ajax} Writes an empty div and a script that has the browser fetch another page into it after the page has loaded.
  • {curl} Fetches a URL and answers the body of the response, optionally kept in a cache for a number of seconds.
  • {content} Keeps a piece of template under a name instead of printing it, for a later {name} to render.