Name

template->field -- Add a variable text string to a template

Synopsis

bool template->text ( int template, float left, float bottom, string name[, string default[, array parameters]] )

Description

This method is used to add a text string to a template. The text string can be specified at the time the template is painted to the page, so it is effectively a "variable".

template must be a valid template ID. bottom and left specify the location of the text string within the template. name is the name of the "variable". When the template is placed, this name is used to determine what value will be used for the string. default is a default value to place if none is defined at the time of template placement. If unspecified, the empty string is used. parameters is an array as described in the parameters documentation. If omitted, default values are used.

Examples

$pdf->enable('template');
$tid = $pdf->template->create();
$pdf->template->rectangle($tid, 0, 0, 15, 100);
$pdf->template->field($tid, 3, 3, "num");
for ($i = 0; $i < 10; $i++) {
    $v['num'] = $i;
    $pdf->template->place($tid, $v, 0, $i * 15, $page);
}

See Also

History

This function was added in version 2.2.

Bugs