HTML Help Builder
URL to access Help topic by Content-ID
Gravatar is a globally recognized avatar based on your email address. URL to access Help topic by Content-ID
  Tom Green
  All
  Sep 7, 2021 @ 07:52pm

I have upload my HELP file, built with HTML Help Builder. Everything works fine.

From my application, I would like to let the user press F1 and navigate to the related HELP topic on our web site.

I can access the URL using the topic PK as:
HTTP://help2021.umana.ca/_5xf0zrt19.htm

Is there a syntax I can use to access it using my the topic's CONTEXT ID?

Gravatar is a globally recognized avatar based on your email address. re: URL to access Help topic by Content-ID
  Rick Strahl
  Tom Green
  Sep 7, 2021 @ 09:42pm

No... the reason this works as it does is that the topic IDs are generated and unique. Context Ids are numeric so not very easy to ensure uniqueness if manually changed and the context Ids aren't available.

What you can do and what I've done is create a separate mapping file that map contextIds to topic ids after you've generated your help file. Both the context ID exists in the .hbp so you can simply do:

SELECT pk, HelpId from (lcHbpFile) INTO TABLE IdLookup

Then when you need to look it up:

SELECT pk FROM Test WHERE HelpId = 349 into Cursor TQUery

GoUrl("https://mysite.com/docs/" + TRIM(TQuery.Pk) + ".htm")

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: URL to access Help topic by Content-ID
  Richard Kaye
  Rick Strahl
  Sep 8, 2021 @ 07:12am

Another strategy would be to use the ...\index.htm?topic=topic name syntax. Then you don't have to worry about the IDs changing.

Gravatar is a globally recognized avatar based on your email address. re: URL to access Help topic by Content-ID
  Rick Strahl
  Richard Kaye
  Sep 8, 2021 @ 10:53am

re: Another strategy would be to use the /index.htm?topic=topic name syntax. Then you don't have to worry about the IDs changing.

Yup that works and is a good choice if you're hand-coding help topics (as I do these days).

But I think Tom's point is that he wants to use the existing help IDs in the FoxPro app and map them to the HTML topics most likely, which is common.

That makes good sense for existing applications that already have help content. The HTML Help viewer is having a lot of problems in Windows these days around security (not showing content unless you mark the help file, bad HTML etc.) so going to an external HTML view (or even a WebBrowser control in the application) is a better choice these days.

In new applications I go straight to mapping help topics either by topic ID rather than by HelpId. But HelpId still can make sense if you need help topics that go down to the control level, for which I don't think there's another way to get notified when help is requested. Personally I tend to map screens to help topics and ensure that screens are not too complex so they can't be documented 😄.

Title is actually very likely to change too, so unless you explicitly want a clean URL it's often also not a good choice for permanently tracking topics. The topic Id is the most reliable way to point at topics as that's pretty unlikely to change.

+++ Rick ---

© 1996-2021