replaceVariableHtml

replaceVariableHtml

BASIC / ADVANCED / PREMIUM

Replaces placeholder variables with HTML.

Description
public replaceVariableHtml($variables, $options = array())

This method replaces text placeholders with HTML/CSS contents.

To embed accents and other non-ASCII characters such as á or ü, and symbols such as ∞ or Ω, please check that the PHP Tidy extension and the PHP mbstring extension are installed and enabled.

Remember that the phppptx template variables should be surrounded by $ symbols or whatever symbol you have chosen via the setTemplateSymbol method.

Parameters

variables

Array with the names of the placeholder template variables as keys and the HTML and CSS that should replace them as values.

options

The possible keys and values of this array are:

Key Type Description
activeSlide bool If true, get only the active slide. Default as false.
target string slides (default).
type string
  • 'block': the variable, together with its containing paragraph, is replaced by the HTML content.
  • 'inline': only the variable is replaced by the inline HTML content.
Code samples

Example #1

The resulting PPTX looks like:

Release notes
  • phppptx 2.5: new method.