PHPePub\Core\EPub::subLevel PHP Method

subLevel() public method

Subsequent chapters will be added to this level.
public subLevel ( string $navTitle = null, string $navId = null, string $navClass = null, boolean $isNavHidden = false, string $writingDirection = null ) : boolean | NavPoint
$navTitle string
$navId string
$navClass string
$isNavHidden boolean
$writingDirection string
return boolean | PHPePub\Core\Structure\NCX\NavPoint The new NavPoint for that level.
    function subLevel($navTitle = null, $navId = null, $navClass = null, $isNavHidden = false, $writingDirection = null)
    {
        return $this->ncx->subLevel(StringHelper::decodeHtmlEntities($navTitle), $navId, $navClass, $isNavHidden, $writingDirection);
    }

Usage Example

Example #1
0
$book->addChapter("Chapter 1: Lorem ipsum", "Chapter001.html", $chapter1, true, EPub::EXTERNAL_REF_ADD);
$log->logLine("Add Chapter 2");
$book->addChapter("Chapter 2: Vivamus bibendum massa", "Chapter002.html", $content_start . "<h1>Chapter 2</h1>\n" . $chapter2);
// Chapter 2 contains an image reference "demo/DemoInlineImage.jpg" which we didn't get it to import
// automatically. So we will do that manually.
$log->logLine("Add referenced image from Chapter 2");
$book->addLargeFile("demo/DemoInlineImage.jpg", "DemoInlineImage", "demo/DemoInlineImage.jpg", "image/jpeg");
$log->logLine("Add Chapter 3");
$book->addChapter("Chapter 3: Vivamus bibendum massa again", "Chapter003.html", $chapter3);
// Auto split a chapter:
$log->logLine("Add Chapter 4");
$book->setSplitSize(15000);
// For this test, we split at approx 15k. Default is 250000 had we left it alone.
$book->addChapter("Chapter 4: Vivamus bibendum massa split", "Chapter004.html", $chapter4, true);
$book->setSplitSize(250000);
$book->subLevel();
$book->addChapter("Chapter 4B: test inlined chapter", "Chapter004.html#sub01");
$book->backLevel();
// More advanced use of the splitter:
// Still using Chapter 4, but as you can see, "Chapter 4" also contains a header for Chapter 5.
$splitter = new EPubChapterSplitter();
$splitter->setSplitSize(15000);
// For this test, we split at approx 15k. Default is 250000 had we left it alone.
$log->logLine("new EPubChapterSplitter()");
/* Using the # as regexp delimiter here, it makes writing the regexp easier.
 *  in this case we could have just searched for "Chapter ", or if we were using regexp '#^<h1>Chapter #i',
 *  using regular text (no regexp delimiters) will look for the text after the first tag. Meaning had we used
 *  "Chapter ", any paragraph or header starting with "Chapter " would have matched. The regexp equivalent of
 *  "Chapter " is '#^<.+?>Chapter #'
 * Essentially, the search string is looking for lines starting with...
 */
All Usage Examples Of PHPePub\Core\EPub::subLevel