PHPePub\Core\EPub::addReferencePage PHP Method

addReferencePage() public method

These do not show up in the regular navigation list. As they are supposed to be short.
public addReferencePage ( string $pageName, string $fileName, string $pageData, string $reference, integer $externalReferences = EPub::EXTERNAL_REF_IGNORE, string $baseDir = "" ) : boolean
$pageName string Name of the chapter, will be use din the TOC
$fileName string Filename to use for the chapter, must be unique for the book.
$pageData string Page content in XHTML. File should NOT exceed 250kB.
$reference string Reference key
$externalReferences integer How to handle external references. See documentation for processChapterExternalReferences for explanation. Default is EPub::EXTERNAL_REF_IGNORE.
$baseDir string Default is "", meaning it is pointing to the document root. NOT used if $externalReferences is set to EPub::EXTERNAL_REF_IGNORE.
return boolean $success
    function addReferencePage($pageName, $fileName, $pageData, $reference, $externalReferences = EPub::EXTERNAL_REF_IGNORE, $baseDir = "")
    {
        if ($this->isFinalized) {
            return false;
        }
        $fileName = RelativePath::getRelativePath($fileName);
        $fileName = preg_replace('#^[/\\.]+#i', "", $fileName);
        if (!empty($pageData) && is_string($pageData)) {
            if ($this->encodeHTML === true) {
                $pageData = StringHelper::encodeHtml($pageData);
            }
            $this->wrapChapter($pageData);
            if ($externalReferences !== EPub::EXTERNAL_REF_IGNORE) {
                $htmlDirInfo = pathinfo($fileName);
                $htmlDir = preg_replace('#^[/\\.]+#i', "", $htmlDirInfo["dirname"] . "/");
                $this->processChapterExternalReferences($pageData, $externalReferences, $baseDir, $htmlDir);
            }
            $this->addFile($fileName, "ref_" . $reference, $pageData, "application/xhtml+xml");
            $this->extractIdAttributes("ref_" . $reference, $pageData);
            if ($reference !== Reference::TABLE_OF_CONTENTS || !isset($this->ncx->referencesList[$reference])) {
                $this->opf->addItemRef("ref_" . $reference);
                //, false);
                $this->opf->addReference($reference, $pageName, $fileName);
                $this->ncx->referencesList[$reference] = $fileName;
                $this->ncx->referencesName[$reference] = $pageName;
            }
            return true;
        }
        return true;
    }