eBook authors eBook Software - create and publish your own ebooks
Create your own eBooks
 
   
EBookApprentice.com
Learn How To Create, Publish & Market E-Books
 
   
EBookCompiler.com
E-Book Creation Software
 
   
EBookPower.com
Add sophisticated multimedia to your E-Books
 
   
CoverFactory.com
Create E-Book covers in minutes
 
 
  EBookSubmit.com
E-Book Marketing & Promotion made easy
 
  EBookJungle.com
Search engine for E-Books
 
  EBookInterviews.com
Interviews with eBook authors
 
  EBookEnhance.com
Tools for building better eBooks
 
 
 
Archived Message:

How to insert text file into template file?


 
bookdealers I'd like to have one template file into which I could then insert the text, using Activ E-Book Compiler: Activ Variables and Activ Scripts.
I read every help page, and searched this message board, but if the answer is there I don't see it (or understand it).
Could someone please tell me how to:
Have one file (template) that has a header and footer into which I could insert the text for that page (another file)?
Many thanks!
Tessa

Posted on: 9:54 pm on November 17, 2003
Alaska Tessa -

Activ can do it, but I ususally use a bit of Javascript.  Try creating a file called footer.js, and paste this into it:

document.write("<hr>" );
document.write("<center>[&nbsp;&nbsp; <a href='index.htm'>home</a>&nbsp;&nbsp;<a href='index.htm'>page 1</a>&nbsp;&nbsp;<a
href='index.htm'>page 2</a>&nbsp;&nbsp;<a href='index.htm'>page 3</a>&nbsp;&nbsp;<a href='index.htm'>page 4</a>&nbsp;&nbsp;<a

href='index.htm'>page 5</a> &nbsp;&nbsp;]</center>" );
document.write("<hr>" );

....and, call it from your page like this:

<SCRIPT LANGUAGE="JavaScript" SRC="footer.js">
</SCRIPT>

there. hope the code survives.


Posted on: 8:05 pm on November 22, 2003
EBookCompiler I usually do it the other way round

Make a template file, say called template.html

Where the text will go, put something like TEXTHERE

Next cut everything above TEXTHERE and put in a separate file in include directory, say top.inc

Cut everything below TEXTHERE and put in a separate file in include directory say, bot.inc

Make Activ Variables top and bot which correspond to these 2 files

For each actually content file, just do

[={top}]
Type the text
[={bot}]

Then enable PreProcessor for all files

HTH


Posted on: 10:08 pm on November 27, 2003
bookdealers Thank you both for your help.  But I still don't "get it."  

Alaska:  I prefer not to use Javascript, but thanks for trying to help.

Sunil Tanna:  Please explain to me again.  I would prefer to do it your way.

I have 3 files:
header (top.html)
text (index.html)
footer (bottom.html)

I want those 3 files to appear on one page in the eBook.

Maybe, if you could compile an eBook for me using my files, then I could download it and see how you did it?

The files are at these locations:

http://www.joyfuldays/book/bottom.html
http://www.joyfuldays/book/index.html
http://www.joyfuldays/book/top.html
http://www.joyfuldays/book/backgade.gif
http://www.joyfuldays/book/bell-icn.gif
http://www.joyfuldays/book/butterfly.gif
http://www.joyfuldays/book/horizontal.gif
http://www.joyfuldays/book/santa-12.jpeg

Many thanks!  I really would like to learn how to do this, it would make it so much easier and use less space if I could insert headers and footers into my book pages.

Tessa


Posted on: 7:40 pm on December 2, 2003
rlemire Have you tried using an "iframe" in your web page? This has to be the easiest way to change content within a web page.

Posted on: 6:02 pm on December 3, 2003
EBookCompiler rlemire's answer is an interesting one, and another variation. I think an issue with iframes etc., is making sure searches etc. go to the right place is going to be more work.  But it's do-able. I'll leave it to rlemire to decide if he wants to expand on his comments/solution.


Going back to my solution, here's how I'd do it

I can't quite do it with the links from bookdealers' site, as the pages all contain the header tags, etc. (so these pages would need editing before you could use my concept)

Let's try it another way. Remember I am using [ ]  instead of greater-than/less-than signs in this post, because I don't want to post real HTML

A normal HTML page would look something like this

[HTML]
[HEAD]
[TITLE]Page Title Here[/TITLE]
[/HEAD]
[BODY]
[More HTML tags etc for top of page design]
The text of the page would go here
[More HTML tags etc for bottom of page design]
[/BODY]
[/HTML]

Right now, if I had two similar pages, the HTML code for both pages would probably be virtually identical except for the little bit which says "The text of the page would go here".

So if I had index.htm and page2.htm then both files would be nearly identical, except for that little bit.

For example index.htm might contain

[HTML]
[HEAD]
[TITLE]Page Title Here[/TITLE]
[/HEAD]
[BODY]
[More HTML tags etc for top of page design]
This is the index page
[More HTML tags etc for bottom of page design]
[/BODY]
[/HTML]

And page2.htm might contain
[HTML]
[HEAD]
[TITLE]Page Title Here[/TITLE]
[/HEAD]
[BODY]
[More HTML tags etc for top of page design]
This is page2
[More HTML tags etc for bottom of page design]
[/BODY]
[/HTML]


So first, I cut the top part (above the text) and put it into a separate file (in the include folder), called top.inc.  This file would contain

[HTML]
[HEAD]
[TITLE]Page Title Here[/TITLE]
[/HEAD]
[BODY]
[More HTML tags etc for top of page design]

Next I do the same for the bottom part, and make bot.inc in the include folder containing

[More HTML tags etc for bottom of page design]
[/BODY]
[/HTML]


Next I set up an Activ Variable called top, which includes HTML from top.inc.  And a variable called bot, which includes HTML from bot.inc.

Next when I create index.htm, I realize that I don't need to duplicate all that stuff, I just reference top and bot :-

NOTE: Really use square brackets for this

[={top}]
This is the index page
[={bot}]

And when I do page2.htm, I create page2.htm like this

NOTE: Really use square brackets for this

[={top}]
This is page2
[={bot}]

Finally, in the compiler, I go to the Files tab, and make sure the PreProcessor is enabled for both index.htm and page2.htm

Now what I have done, is allow me to create 2 pages on a common template (but I could follow the same principle for more HTML pages too), without duplicating lots of HTML code.


Finally to answer why I couldn't quite do this with bookdealers' top.html and bottom.html  ....

If you open top.html or bottom.html or index.html in a text editor, (like Notepad etc), you will see that they are all in themselves complete pages, including the HEAD, /HEAD BODY, /BODY HTML, /HTML tags... unlike the example I just gave.  


Posted on: 6:13 pm on December 28, 2003

Go to Active Discussion Thread

Participate in Current/New Discussions

List All Archived Forums



Copyright © 2000-2015, Answers 2000 Limited.

With any business, it is up to the individual owner of said business to ensure the success of the business. You may make more or less than any sample figures or results that might be quoted on our web sites or other publications. All business involves risk, and many businesses do not succeed. Further, Answers 2000 Limited does NOT represent that any particular individual or business is typical, or that any results or experiences achieved by any particular individual/business is necessarily typical.

Disclosure: Our company's websites' content (including this website's content) includes advertisements for our own company's websites, products, and services, and for other organization's websites, products, and services. In the case of links to other organization's websites, our company may receive a payment, (1) if you purchase products or services, or (2) if you sign-up for third party offers, after following links from this website. Unless specifically otherwise stated, information about other organization's products and services, is based on information provided by that organization, the product/service vendor, and/or publicly available information - and should not be taken to mean that we have used the product/service in question. Additionally, our company's websites contain some adverts which we are paid to display, but whose content is not selected by us, such as Google AdSense ads. For more detailed information, please see Advertising/Endorsements Disclosures

Our sites use cookies, some of which may already be set on your computer. Use of our site constitutes consent for this. For details, please see Privacy.

Contact Us    About and Terms Of Use    Privacy    Advertising/Endorsements Disclosures