1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Is there any way of getting the content of a book?

Discussion in 'Development' started by unlimitedcoder2, Jun 22, 2018.

  1. unlimitedcoder2

    unlimitedcoder2 Creeper

    Messages:
    1
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Yes, use WritableBook::getPages().
    PHP:
    /** @var WritableBook $book */
    $pages $book->getPages();
    foreach(
    $pages as $page){
        
    $text $page->getString(WritableBook::TAG_PAGE_TEXT);
        
    //var_dump($text);
    }
    To be more specific, if you want the text on page 1...
    PHP:
    $page 1;
    $text $book->getPageText($page);
    if(
    $text === null){
        
    //page 1 does not exist or is empty.
    }else{
        
    //do something
    }
     
    Lolipop78709 likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.