Internal Links in Example1Book.epub file

Recommend this page to a friend!

      EPub  >  All threads  >  Internal Links in Example1Book.epub file  >  (Un) Subscribe thread alerts  
Subject:Internal Links in Example1Book.epub file
Summary:About internal links in example file
Messages:10
Author:Joao Chagas
Date:2013-07-28 22:43:50
Update:2013-07-29 23:43:14
 

  1. Internal Links in Example1Book.epub file   Reply   Report abuse  
Picture of Joao Chagas Joao Chagas - 2013-07-28 22:43:50
Hello,
Can you tell me please how works the internal links in the sample file:Example1Book.epub?
Can you post please here some examples?

The best regards, JC

  2. Re: Internal Links in Example1Book.epub file   Reply   Report abuse  
Picture of Asbjorn Grandt Asbjorn Grandt - 2013-07-29 06:47:07 - In reply to message 1 from Joao Chagas
Hi,

Are you talking about links from one link inside to another inside that same chapter, or book, or something else?

Cheers

  3. Re: Internal Links in Example1Book.epub file   Reply   Report abuse  
Picture of Joao Chagas Joao Chagas - 2013-07-29 07:24:09 - In reply to message 2 from Asbjorn Grandt
Hello,
Yes. For example, link from chapter 2 to chapter 5.
If it is possible, from chapter 2 to a specific part of chapter 3 (like a anchor).
The best regards. JC

  4. Re: Internal Links in Example1Book.epub file   Reply   Report abuse  
Picture of Asbjorn Grandt Asbjorn Grandt - 2013-07-29 11:01:04 - In reply to message 3 from Joao Chagas
I'll have to look at it, but if you have named your chapters Ch01.html ... Ch05.html you should be able to reach these with a regular anchor.

<a id="internalLink1"></a>

and from for instance Ch05.html to Ch03.html
<a href="Ch03.html#internalLink1" />

I'll have to check if I need to add anything to the ePub metadata for this to work.

  5. Re: Internal Links in Example1Book.epub file   Reply   Report abuse  
Picture of Joao Chagas Joao Chagas - 2013-07-29 17:59:30 - In reply to message 4 from Asbjorn Grandt
Hello,
I insert this line in line 75 (after:. "<h2>Lorem ipsum</h2>\n"):
. "<a href=\"Chapter003.html#internalLink1\"/>click here</a>\n"

And insert in line 95 (after: . "<h2>Vivamus bibendum massa</h2>\n"):
. "<a id=\"internalLink1\">here the anchor</a>\n"

The behavior when I click in the link is: the page go to notices/Cover.html.

Also I try follow the instructions of this page and not work too.

Can you help me please?

The best regards, JC

  6. Re: Internal Links in Example1Book.epub file   Reply   Report abuse  
Picture of Joao Chagas Joao Chagas - 2013-07-29 18:00:18 - In reply to message 5 from Joao Chagas
The page that I try to follow too:
forum.pressbooks.com/index.php?p=/d ...

~JC

  7. Re: Internal Links in Example1Book.epub file   Reply   Report abuse  
Picture of Asbjorn Grandt Asbjorn Grandt - 2013-07-29 18:32:30 - In reply to message 6 from Joao Chagas
The problem with Chapter 3 in my examples, is that it is a demonstration of a single chapter split over multiple files. So EPub adds to the chapter name for each chapter contained in the array passed.
The first of the two in this example is actually stores as Chapter003-1.html

I added these two lines to Chapter 001:
. "<p><a href=\"Chapter002.html#internalLink\">Go to Chapter 2</a></p>\n"
. "<p><a href=\"Chapter003-1.html#internalLink\">Go to Chapter 3</a></p>\n"


The added an id="internalLink" to a paragraph (ie: <p id="internalLink">....)
I did this in both the first part of Chapter 3 and somewhere in Chapter 2.

As for maintaining integrity when these files are renames, I have to have a closer look at my code to see if it is something I can improve on.

  8. Re: Internal Links in Example1Book.epub file   Reply   Report abuse  
Picture of Joao Chagas Joao Chagas - 2013-07-29 18:58:56 - In reply to message 7 from Asbjorn Grandt
Hi again,
Now both links have a strange behavior, your example works only to the second attempt, any one of the links. When click in the first time in each link remains open "notice/Cover.html", but when I click in the second time the links open the right chapters. Very strange behavior.
The internal links was very important in my e-book, because I want create interactive e-books.
You have tried in Example1Book.epub put internal links?
If you want I can send my file "Example1Book.epub" for you analyze! If yes tell me your email please.

The best regards, JC

  9. Re: Internal Links in Example1Book.epub file   Reply   Report abuse  
Picture of Asbjorn Grandt Asbjorn Grandt - 2013-07-29 19:11:24 - In reply to message 8 from Joao Chagas
hi


Send it to php@grandt.com

I tried it, and didn't have any issues on it. Of course the internal link id's have to be unique, though you can have the same id occurring in different chapters, it might be a good idea to avoid that till I'm sure it works.

dl.dropboxusercontent.com/u/1056166 ...

  10. Re: Internal Links in Example1Book.epub file   Reply   Report abuse  
Picture of Joao Chagas Joao Chagas - 2013-07-29 23:43:14 - In reply to message 9 from Asbjorn Grandt
After comunicate with @Grandt via email, the right code is:
(example in the version of Example1Book.php)
Insert in line 75 and 76 the internal links:
. "<p><a href=\"Chapter002.html#internalLink1\">Go to Chapter 2</a></p>\n"
. "<p><a href=\"Chapter003-1.html#internalLink2\">Go to Chapter 3</a></p>\n"

The anchor insert for example in lines 86 and 98
. "<p id=\"internalLink1\">anchor c2</p>\n"
. "<p><a id=\"internalLink2\">here the anchor</a></p>\n"

This example work in Adobe Digital Edition 2.0 and in ipad (ibooks), but not work well in firefox ad-on "Epubreader", the bug has already been reported by the author of the class, I hope that solve very fast for the good of all programmers using this class.

Thank you @Grandt.

The best regards, JC

 

For more information send a message to info at phpclasses dot org.