Cannot Create Header/Footer

Please post all questions relating to Help & Manual 6 here!

Moderators: Alexander Halser, Tim Green

Post Reply
dreesor
Posts: 20
Joined: Tue Jul 20, 2010 9:34 pm
Location: Edmonton, Canada

Cannot Create Header/Footer

Unread post by dreesor »

Can someone please help me create a header/footer in the default template? I followed instructions and worked with both the text and html options, I created numerous new templates, but just cannot make a header or footer appear.

My goal is to insert an image as a footer. So while I am trying to get the text "SAMPLE FOOTER" as in the screenshots, it is step one to embedding an image. That said, when I am able to get the footer to populate in the template, do I just link to an image in the images folder for the project, or does it need to be a link to a web-image, or include in baggage files? Assistance with that part of the objective is much appreciated as well.

Thanks for your assistance.
header_footer html.png
header_footer text.png
You do not have the required permissions to view the files attached to this post.
User avatar
Tim Green
Site Admin
Posts: 23189
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Cannot Create Header/Footer

Unread post by Tim Green »

Hi Dree,

You're almost there. It's easiest to add your code to the source code, not in the simple layout tab. Also, once you edit the the source code, DON'T switch back to the simple tab again -- that would delete all your edits and replace them with the standard layout (you will be warned if you try to do this).

Your header and/or footer code needs to be inside the table containing the <%TOPIC_TEXT%> variable that inserts the topic content. So it should be directly above or directly below that variable, with no other code in between. Otherwise it's not part of the part of the page that is displayed as your topic content. Also, if you want to insert a paragraph it must also include paragraph tags. So your sample footer should look like this:

Code: Select all

<p><b>SAMPLE FOOTER</b></p> 
If you want to insert an image you need to do two things: 1) Add the image file to the Baggage Files section of your project, so that it gets exported with the project. and 2) use an <img> tag to insert the image. In its most basic form that would look like this:

Code: Select all

<img src="your_image.png" border="0" />
IMPORTANT: The image file name must not contain any spaces or special characters. File names like that don't work in web browsers!

If you are going to do more of this kind of thing you're going to need a primer on HTML and CSS. To get you started, I can warmly recommend the Head First book on HTML from OReilly.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
dreesor
Posts: 20
Joined: Tue Jul 20, 2010 9:34 pm
Location: Edmonton, Canada

Re: Cannot Create Header/Footer

Unread post by dreesor »

Tim

As always, thanks for your careful and detailed response. I am just missing one little piece I think; the location of my HTML. I use Kompozer as my editor, and tried the following two code bits in testing. I tried them in the templates, but as that was not working, I decided to try inserting an HTML code object. While "SAMPLE FOOTER" is appearing on that one page from the one HTML object, the second effort is not calling the image (truthfooter.png).

So I have two issues: I cannot get the footer to appear in the template; nor do I have the path correct to the image in the baggage folder.

In the following codes examples I have the image and words only HTML code, followed by the code from a template try.

Thanks for taking a look at this Tim.

Dale

Code: Select all

Image in Baggage Files

<!-- Placeholder for topic body. -->
<table style="border: medium none ; width: 100%;">
  <tbody>
    <tr style="vertical-align: top;">
      <td style="padding: 5px; text-align: left;"><%TOPIC_TEXT%>;
      <p><img alt="footer" src="<img src="truthfooter.png" border="0" /></p>
      </td>
    </tr>
  </tbody>
</table>

Words Only

<!-- Placeholder for topic body. -->
<table style="border: medium none ; width: 100%;">
  <tbody>
    <tr style="vertical-align: top;">
      <td style="padding: 5px; text-align: left;"><%TOPIC_TEXT%>;
      <p>SAMPLE FOOTER</p>
      </td>
    </tr>
  </tbody>
</table>

Help and Manual Page Template

<!-- Placeholder for topic body. -->
<table style="width:100%;border:none;border-spacing:0px"><tr style="vertical-align:top"><td style="text-align:left;padding:5px">
<%TOPIC_TEXT%> <P>SAMPLE FOOTER</P>
</td></tr></table>
User avatar
Tim Green
Site Admin
Posts: 23189
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Cannot Create Header/Footer

Unread post by Tim Green »

Hi Dale,

This is very wrong, unfortunately. You must never insert any content that you want to have on the page outside of the tag containing the <%TOPIC_TEXT%> variable. You have also created multiple copies of the table containing the topic text variable, which will produce very weird results. Also, don't use external editors, or be very careful with using them unless you are absolutely sure that they are not going to change or add to your code in unexpected ways. The HTML templates in Help & Manual contain a lot of non-HTML variables that are removed and replaced before the template page is actually turned into HTML, and if an editor messes with any of that or the structure of the page you will get serious problems.

In the case of this template this means:

Code: Select all

==>> Insert NOTHING above this opening <td... tag!!!
<td style="padding: 5px; text-align: left;">
==>> Anything inserted here must be normal HTML code and will appear ABOVE your topic content.
==>> NO TEXT outside of valid HTML tags!!!
<%TOPIC_TEXT%>
==>> Anything inserted here must be normal HTML code and will appear BELOW your topic content.
==>> NO TEXT outside of valid HTML tags!!!
</td>
==>> Insert NOTHING below this closing </td> tag!!!
Also, DON'T insert any additional characters like the semicolon after the <%TOPIC_TEXT%> variable or anywhere else outside of HTML tags. That can make the entire page invalid, or at least cause strange and inexplicable errors. Here is an example of a valid header and footer, with text in the header and an image in the footer:

Code: Select all

<td style="padding: 5px; text-align: left;">
<p>This will be a header paragraph</p>
<%TOPIC_TEXT%>
<p><img src="myimage.png" border="0" title="Image as a footer" /></p>
</td>
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
dreesor
Posts: 20
Joined: Tue Jul 20, 2010 9:34 pm
Location: Edmonton, Canada

Re: Cannot Create Header/Footer

Unread post by dreesor »

Tim

Thanks for your response.

I copied and pasted your code into the template HTML; but it just was not appearing. Then more documentation searching... Seems the skin I was using was stripping the customizations from the template at time of publishing. Published without a skin and both the text and image footer works great. Now I will see about customizing the skin. Thanks for your assistance I think I am on a good road once again. Here's hoping!

Dale
User avatar
Tim Green
Site Admin
Posts: 23189
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Cannot Create Header/Footer

Unread post by Tim Green »

Hi Dale,

If you are using a skin you must edit in the skin, NOT in the project. When you use a skin, the skin's templates and settings completely replace all the matching templates and settings in your project, so the versions in your project are just ignored. Nothing you edit there will have any effect when using a skin. So you need to open the .hmskin file and edit that. Its internals are just like a normal Help & Manual project, it just doesn't have any topics of its own.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
lstinson
Posts: 9
Joined: Fri Dec 29, 2006 12:26 am

Re: Cannot Create Header/Footer

Unread post by lstinson »

May I revive this thread?
I need to add a footer to all topics in my CHM output. I added the identical code in both the project's Default HTML Page Template, and in my skin's Default HTML Page Template. If I compile WITHOUT the skin, I see the footer. If I compile WITH the skin, no footer. What am I doing wrong?

Laura
User avatar
Martin Wynne
Posts: 2656
Joined: Mon May 12, 2003 3:21 pm
Location: West of the Severn, UK

Re: Cannot Create Header/Footer

Unread post by Martin Wynne »

Hi Laura,

Did you remember to Save the skin? If you have both skin and project open at the same time, it's easy to forget to do that. It's always catching me out. :)

regards,

Martin.
User avatar
Tim Green
Site Admin
Posts: 23189
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Cannot Create Header/Footer

Unread post by Tim Green »

Hi Laura,

In addition to what Martin suggested: If you are using a skin you don't need to do any edits in your project HTML templates at all. Those are never even looked at when you use a skin, because the templates in the skin completely replace those in the project.

Just make sure that you save the skin and also that you are really using the same copy of the skin that you edited. Save it in your project folder, and select it explicitly with the Select Skin option in the Publish screen before publishing. Don't select it from the preview images: Instead, select the "Open Skin..." menu item at the top and select the skin file directly.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
lstinson
Posts: 9
Joined: Fri Dec 29, 2006 12:26 am

Re: Cannot Create Header/Footer

Unread post by lstinson »

Yes, I did all that. Tim, I only copied the code from the skin to the project to test whether it was a problem with the code itself. Even tried saving a different skin to the project folder, configuring it with the footer code, and compiling the project with the new skin selected. Still no love. I'm really at a loss here.
lstinson
Posts: 9
Joined: Fri Dec 29, 2006 12:26 am

Re: Cannot Create Header/Footer

Unread post by lstinson »

OK, copied over the original skin to the project file, edited it, and compiled. Footer is there! I may never know what I broke in the skin, but I'm not looking back. :-)
Post Reply