public function setVars($key, $value, $encode = true, $charset = 'ISO-8859')
    {
        $tag= $this->config['DELIMITER_LEFT'] . $key . $this->config['DELIMITER_RIGHT'];
        if (strpos($this->contentXml, $tag) === false && strpos($this->stylesXml, $tag) === false) {
                throw new OdfException("var $key not found in the document");
        }
        $value = $encode ? $this->recursiveHtmlspecialchars($value) : $value;
        $value = ($charset == 'ISO-8859') ? utf8_encode($value) : $value;
        $this->vars[$tag] = str_replace("\n", "<text:line-break/>", $value);
        return $this;
    }
public function setVars($key, $value, $encode = true, $charset = 'ISO-8859')
    {
        $tag= $this->config['DELIMITER_LEFT'] . $key . $this->config['DELIMITER_RIGHT'];
        if (strpos($this->contentXml, $tag) === false && strpos($this->stylesXml, $tag) === false) {
                throw new OdfException("var $key not found in the document");
        }
        $value = $encode ? $this->recursiveHtmlspecialchars($value) : $value;
        $value = ($charset == 'ISO-8859') ? utf8_encode($value) : $value;
        $this->vars[$tag] = str_replace("\n", "<text:line-break/>", $value);
        return $this;
    }
public function setVars ( $ key , $ value , $ encode = true , $ charset = 'ISO-8859' ) { $ tag = $ this -> config [ 'DELIMITER_LEFT' ] . $ key . $ this -> config [ 'DELIMITER_RIGHT' ] ; if ( strpos ( $ this -> contentXml , $ tag ) === false && strpos ( $ this -> stylesXml , $ tag ) === false ) { throw new OdfException ( "var $key not found in the document" ) ; } $ value = $ encode ? $ this -> recursiveHtmlspecialchars ( $ value ) : $ value ; $ value = ( $ charset == 'ISO-8859' ) ? utf8_encode ( $ value ) : $ value ; $ this -> vars [ $ tag ] = str_replace ( "\n" , "<text:line-break/>" , $ value ) ; return $ this ; }
Assing a template variable

@param string $key name of the variable within the template
@param string $value replacement value
@param bool $encode if true, special XML characters are encoded
@throws OdfException
@return odf
Assing a template variable