replaceVariablePptxFragment

replaceVariablePptxFragment

BASIC / ADVANCED / PREMIUM

Replaces placeholder variables with PptxFragment.

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

This method replaces a set of placeholder variables with PptxFragment.

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 PpptxFragments 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), notesSlides, slideLayouts, slideMasters.
type string inline (only replaces the variable), block (default, removes the variable and its containing paragraph).
Exceptions

Not valid PptxFragment.

Code samples

Example #1

The resulting PPTX looks like:

Release notes
  • phppptx 3.0:
    • notesSlides, slideLayouts and slideMasters targets.
  • phppptx 2.5:
    • supported contents with external relationships.
  • phppptx 2.0:
    • new method.