getTemplateVariables

getTemplateVariables

BASIC / ADVANCED / PREMIUM

Returns the template placeholder variables as an array.

Description
public getTemplateVariables()

This method returns all phppptx placeholder variables of the current template.

In order to work properly with this method, it is recommended not to use the symbol chosen for delimiting the placeholders in other contents of the presentation. It is preferable to use a unique symbol or ${} for placeholders.

To extract the placeholders, the public static variable CreatePptxFromTemplate::$regExprVariableSymbols is used. This variable contains a regular expression with the conditions to extract the variables, ([^ ]*) as default, so placeholders without empty spaces must be used to get them automatically with the getTemplateVariables method. If needed, this variable can be customized to use other regular expression.

Return values

Array with the template variables included in the PowerPoint template

Code samples

Example #1

Release notes
  • phppptx 3.0:
    • notesSlides, slideLayouts and slideMasters targets.
  • phppptx 1.0:
    • new method.