Custom HTML page instead of Navigation frame

HM5 served us well, now its time has come and it has been replaced... If you have HM5 questions, please post them here.

Moderators: Alexander Halser, Tim Green

Post Reply
Alexey Zhebel
Posts: 38
Joined: Tue Jun 07, 2011 10:03 am

Custom HTML page instead of Navigation frame

Unread post by Alexey Zhebel »

Is it possible to have a custom HTML page displayed instead of the Navigation frame?

Is it possible to put an IF expression in the Layout of a skin, so that the Navigation page is replaced with a custom HTML page only with a certain user-defined build?
User avatar
Tim Green
Site Admin
Posts: 23189
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Custom HTML page instead of Navigation frame

Unread post by Tim Green »

Hi Alexey,
Is it possible to have a custom HTML page displayed instead of the Navigation frame?
You can edit everything in all the templates in the WebHelp layout. The templates are all in the Configuration > Publishing Options > WebHelp section in the Project Explorer. The main index.html page is generated by the Layout template. This contains the definitions of the frames and the references to the pages that are loaded into them. The other pages that are loaded into these frames are defined by the Table of Contents, Keyword Index and Full Text Search templates. Then there is the topic page template(s) which define(s) the topics that are loaded into the topic frame.
Is it possible to put an IF expression in the Layout of a skin, so that the Navigation page is replaced with a custom HTML page only with a certain user-defined build?
Absolutely. You can use IF conditions in templates just as you can anywhere else. They just have a slightly different syntax, see this topic in the help for details.

In addition to this there is a very useful undocumented feature that enables you to insert the contents of files stored in the Baggage Files section in templates. You use it like this:

Code: Select all

<HMINCLUDE:hmphone.js>
This inserts the entire contents of the referenced file in the template, replacing this line of code with the contents of the file. You can use both variables and conditions in the baggage file, they are all processed on inserting. You must make sure that the baggage files are not exported when you do this, because they just need to be used as source files. So set their include options to "none" in the baggage files section. Also note that if you are inserting javascript or CSS the file must include the necessary start and end tags -- for example <script type="text/javascript">...</script> for javascript code and <style type="text/css">...</style> for CSS code.

This is a very powerful feature, because it allows you to store entire blocks of template code in the baggage and replace it with conditions (you can put conditions around the HMINCLUDE statement as well, of course...)
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.
Alexey Zhebel
Posts: 38
Joined: Tue Jun 07, 2011 10:03 am

Re: Custom HTML page instead of Navigation frame

Unread post by Alexey Zhebel »

Tim Green wrote:Hi Alexey,
Is it possible to have a custom HTML page displayed instead of the Navigation frame?
You can edit everything in all the templates in the WebHelp layout. The templates are all in the Configuration > Publishing Options > WebHelp section in the Project Explorer. The main index.html page is generated by the Layout template. This contains the definitions of the frames and the references to the pages that are loaded into them. The other pages that are loaded into these frames are defined by the Table of Contents, Keyword Index and Full Text Search templates. Then there is the topic page template(s) which define(s) the topics that are loaded into the topic frame.
Is it possible to put an IF expression in the Layout of a skin, so that the Navigation page is replaced with a custom HTML page only with a certain user-defined build?
Absolutely. You can use IF conditions in templates just as you can anywhere else. They just have a slightly different syntax, see this topic in the help for details.
I tried to to generate a webhelp with a custom page.html loaded into the navigation frame for TEST_BUILD. For this, I opened the Layout source code in the skin file and changed this line:

Code: Select all

<frame name="hmnavigation" id="hmnavigation" src="<%HREF_CONTENT_PAGE_STATIC%>" title="Navigation frame" scrolling="yes" />
to this:

Code: Select all

<IFNOT_TEST_BUILD>
<frame name="hmnavigation" id="hmnavigation" src="<%HREF_CONTENT_PAGE_STATIC%>" title="Navigation frame" scrolling="yes" />
</IFNOT_TEST_BUILD>
<IF_TEST_BUILD>
<frame name="hmnavigation" id="hmnavigation" src="page.html" title="Navigation frame" scrolling="yes" />
</IF_TEST_BUILD>
The syntax looks correct, I have page.html in the same folder as index.html for the output, but it doesn't work. The TOC is still displayed as usual. What am I missing?

I also tried to delete the line with the Navigation frame completely, but that also doesn't work. So my guess is that the frame is declared elsewhere?
User avatar
Tim Green
Site Admin
Posts: 23189
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Custom HTML page instead of Navigation frame

Unread post by Tim Green »

Hi Alexey,
The syntax looks correct, I have page.html in the same folder as index.html for the output, but it doesn't work. The TOC is still displayed as usual. What am I missing?
You are probably using a skin. If you do that you need to edit the skin, not your project, because the skin replaces all the templates in your project with those in your skin. You can open and edit skin files just like normal projects, everything is in the same place (actually, they are projects, just without topics and some other sections). Select Open and then select .hmskin as the file type to open in the Open dialog.
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.
Alexey Zhebel
Posts: 38
Joined: Tue Jun 07, 2011 10:03 am

Re: Custom HTML page instead of Navigation frame

Unread post by Alexey Zhebel »

No, Tim, I've been changing the skin file. Does it understand builds which are only defined in the project or do I need to create a similar build in the skin file?

For my example, I have TEST_BUILD defined in the project file only. It is not present in the skin.
User avatar
Tim Green
Site Admin
Posts: 23189
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Custom HTML page instead of Navigation frame

Unread post by Tim Green »

Make sure that the custom build is defined in the skin if you are using it in the skin template. 8)
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.
Alexey Zhebel
Posts: 38
Joined: Tue Jun 07, 2011 10:03 am

Re: Custom HTML page instead of Navigation frame

Unread post by Alexey Zhebel »

It looks like that was the problem. I thought that the skin uses project builds in addition to its internally defined builds when publishing the project.
Alexey Zhebel
Posts: 38
Joined: Tue Jun 07, 2011 10:03 am

Re: Custom HTML page instead of Navigation frame

Unread post by Alexey Zhebel »

I tried to delete the line where the navigation frame is declared and I still get the TOC displayed.
Alexey Zhebel
Posts: 38
Joined: Tue Jun 07, 2011 10:03 am

Re: Custom HTML page instead of Navigation frame

Unread post by Alexey Zhebel »

Here is what I am trying to do:

I have two webhelps which are generated from one project using a single PP skin. Each has a designated custom build. I also need to generate a "landing page" from which I the user can select to open either Webhelp A or Webhelp B. So what I did is added a hidden topic (named "index") and included it into the standard Webhelp build (so that's build named HTML). I generate this build to /webhelp/index.html using a single-frame skin (not a PP skin). Then I generate the two webhelps into /webhelp/webhelp_a/index.html and /webhelp/webhelp_b/index.html. The links from the "landing page webhelp" are relative so they point to the index pages of the two main webhelps.

This works, but I thought it would be easier to use the same skin for all three builds. So what I want is, when I generate build HTML, so that it would not use the TOC at all, but load a custom page inside the navigation frame. Then I can have index.html displayed in the main contents frame (this would contain links to the two main webhelps) and a custom page.html displayed in the navigation frame instead of the TOC (this would contain some additional useful external links and stuff).

Doing this didn't help:

Code: Select all

<IFNOT_HTML>
<frame name="hmnavigation" id="hmnavigation" src="<%HREF_CONTENT_PAGE_STATIC%>" title="Navigation frame" scrolling="yes" />
</IFNOT_HTML>
<IF_HTML>
<frame name="hmnavigation" id="hmnavigation" src="page.html" title="Navigation frame" scrolling="yes" />
</IF_HTML>
I still have tan empty TOC displayed in the navigation frame although it obviously should load page.html into it.
Alexey Zhebel
Posts: 38
Joined: Tue Jun 07, 2011 10:03 am

Re: Custom HTML page instead of Navigation frame

Unread post by Alexey Zhebel »

OK, I know nothing about JS but I managed to find a solution. In a script at the beginning of the Layout source code there is a variable named hmContents which is set to the content page. So I changed the declaration of this variable to:

Code: Select all

<IFNOT_HTML>var hmContents = document.getElementById ? "<%HREF_CONTENT_PAGE_DYN%>" : "<%HREF_CONTENT_PAGE_STATIC%>";</IFNOT_HTML>
<IF_HTML>var hmContents = "page.html";</IF_HTML>
It helped!
Post Reply