1

I have my nodes organized using the book module. I would like to be able to display the page number at the bottom of the page. The pages would be numbered according to the order in the book outline. Is this possible? I even tried looking for a PHP code snippet I could put in book-navigation.tpl.php or similar.

4
  • if you re-arrange a books' pages -- wouldn't the page numbers be meaningless? (you can re-arrange a books' content).
    – tenken
    Feb 9, 2014 at 0:02
  • Its an online text book so I mostly just edit pages. You are right that inserting a page at the beginning would cause all the pages to re-number. However, its rare that I do that.
    – user26061
    Feb 9, 2014 at 0:58
  • I looked into it. There kinda is no easy way (due to the "bug" i outline above). I can think of a few solutions but they would be hackish and likely difficult to implement. I know of no such module you can install to do this now without custom code.
    – tenken
    Feb 9, 2014 at 4:33
  • Can anyone give answer/solution for this question enter link description here
    – Raj K
    Apr 10, 2020 at 10:28

1 Answer 1

0

You can add simple PHP code in your node.tpl.php

    <?php
      $allbook = book_toc($node->book['bid'],3);
     $allbook_chapter = array_search($node->book['mlid'], array_keys($allbook));
print $allbook_chapter;
            ?>

This code prints page number of current node. This in't better way of course. Moving this logic to template.php is better solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.