TPLix

No results for ""

Capture

2 min read Jun 2, 2026
--- title: capture autoseo: enabled: true theme: learn2 child_type: default admin: children_display_order: collection visible: true ---

capture — Captures all the output within this block and saves it into {$.capture.name} if you provide another name.

Using function

<?php
capture([string $name = 'default', [ string $assign = null, [ bool $cat = false ]]])
  • name capture name, used to read the value afterwards
  • assign: if set, the value is also saved in the given variable
  • cat: if true, the value is appended to the previous one (if any) instead of overwriting it. If the cat parameter is true, the content will be appended to the existing content.
How to use in .tpl files is shown below:
Example #1:
{capture name="default"}
Hi hi
{/capture}
Captured: {$.capture.default}
{capture "foo"}
Anything in here wont show, it will be saved for later use..
{/capture}
Captured: {$.capture.foo}

The above example will output:

Captured: Anything in here wont show, it will be saved for later use..

Leave a Comment

Not published. Used to notify you on approval.

Comments are moderated before appearing.