Load any number of headers and footers

This commit is contained in:
Dave Gudgeon 2014-04-01 22:13:03 +01:00
parent 763de347df
commit 4f514d2159

View File

@ -75,16 +75,17 @@ class Template
$this->_objZip = new $zipClass(); $this->_objZip = new $zipClass();
$this->_objZip->open($this->_tempFileName); $this->_objZip->open($this->_tempFileName);
// Find and load up to three headers and footers // Find and load headers and footers
for ($i = 1; $i <= 3; $i++) { $i = 1;
$headerName = $this->getHeaderName($i); while ($this->_objZip->locateName($this->getHeaderName($i)) !== false) {
$footerName = $this->getFooterName($i); $this->_headerXMLs[$i] = $this->_objZip->getFromName($this->getHeaderName($i));
if ($this->_objZip->locateName($headerName) !== false) { $i++;
$this->_headerXMLs[$i] = $this->_objZip->getFromName($headerName); }
}
if ($this->_objZip->locateName($footerName) !== false) { $i = 1;
$this->_footerXMLs[$i] = $this->_objZip->getFromName($footerName); while ($this->_objZip->locateName($this->getFooterName($i)) !== false) {
} $this->_footerXMLs[$i] = $this->_objZip->getFromName($this->getFooterName($i));
$i++;
} }
$this->_documentXML = $this->_objZip->getFromName('word/document.xml'); $this->_documentXML = $this->_objZip->getFromName('word/document.xml');