Hi all,
I want to use some IF conditions in the popup template file _hmXpopup.html.
In the generated webhelp, they are output as is. I see all conditions plain in the HTM file.
<IF_OPT_MYCONDITION>
<p>Error: Popup content not loaded</p>
</IF_OPT_MYCONDITION>
<IFNOT_OPT_MYCONDITION>
<p>Error: Popup content not loaded, please contact xxx</p>
</IFNOT_OPT_MYCONDITION>
Is this a bug or a feature? I am using 9.6.0 Build 6810
IF conditions in _hmXpopup.htm not supported?
Moderators: Alexander Halser, Tim Green
-
- Posts: 53
- Joined: Tue Apr 30, 2019 4:29 pm
- Tim Green
- Site Admin
- Posts: 23386
- Joined: Mon Jun 24, 2002 9:11 am
- Location: Bruehl, Germany
- Contact:
Re: IF conditions in _hmXpopup.htm not supported?
Hi Markus,
The conditions won't work there because Help+Manual only parses conditions and variables in its own templates (Page, Search, TOC, Index, Layout if used). It also parses conditions and variables in CSS and JS files if that is activated in the skin (it is in all Premium Pack skins). You can also create "variable-based conditions" in CSS and JS and templates using variables with the special syntax :
You can use both conditions and variables in any baggage files if they are merged into the main templates (and ONLY there) using the special syntax:
but that is not the case for the special template files used for popups in the Premium Pack skin you are using because those are really exported as HTML files to the web server and loaded there at runtime when the popups are displayed. So the answer is that there you can't use variables or conditions there.
The conditions won't work there because Help+Manual only parses conditions and variables in its own templates (Page, Search, TOC, Index, Layout if used). It also parses conditions and variables in CSS and JS files if that is activated in the skin (it is in all Premium Pack skins). You can also create "variable-based conditions" in CSS and JS and templates using variables with the special syntax :
Code: Select all
<IF_VAR[VARNAME=value value]> ... </IF_VAR[VARNAME=value value]>
<IFNOT_VAR[VARNAME=value value]> ... </IFNOT_VAR[VARNAME=value value]>
Code: Select all
<HMINCLUDE:filename>
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.
Tim (EC Software Documentation & User Support)
Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
-
- Posts: 53
- Joined: Tue Apr 30, 2019 4:29 pm
Re: IF conditions in _hmXpopup.htm not supported?
Got it. Thanks for your reply, Tim.
- Tim Green
- Site Admin
- Posts: 23386
- Joined: Mon Jun 24, 2002 9:11 am
- Location: Bruehl, Germany
- Contact:
Re: IF conditions in _hmXpopup.htm not supported?
BTW: I updated my reply to explain why those template files aren't parsed by HM: They are really exported as actual HTML files to the web server and loaded there at runtime when the popups are generated dynamically and displayed. So they don't fall into any category that Help+Manual parses, unfortunately.
What you could do is this: Define and set your own variables in a place where they can be parsed, for example by using the postload functions for adding your own code. Then reference those variables with your own JS added to the popup template to add the code or perform the functions you need there.
What you could do is this: Define and set your own variables in a place where they can be parsed, for example by using the postload functions for adding your own code. Then reference those variables with your own JS added to the popup template to add the code or perform the functions you need there.
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.
Tim (EC Software Documentation & User Support)
Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
-
- Posts: 53
- Joined: Tue Apr 30, 2019 4:29 pm
Re: IF conditions in _hmXpopup.htm not supported?
Thanks for the suggestion using the postloadFuncs.js.
I am calling the popups from an application, not within the help. So there is a chance a user has never called the help before and if I see this right, postloadFuncs is not loaded in popup call, is it?
In my case, it is about to display text or not. Instead of BUILDS, I can solve this with JS executed in the popup.
I am calling the popups from an application, not within the help. So there is a chance a user has never called the help before and if I see this right, postloadFuncs is not loaded in popup call, is it?
In my case, it is about to display text or not. Instead of BUILDS, I can solve this with JS executed in the popup.
- Tim Green
- Site Admin
- Posts: 23386
- Joined: Mon Jun 24, 2002 9:11 am
- Location: Bruehl, Germany
- Contact:
Re: IF conditions in _hmXpopup.htm not supported?
No, but any variables you define with it are in the main JS thread of the entire skin, so the variables should be available in the popup. Give it a try.
That would be a simple solution if that is OK for you.In my case, it is about to display text or not. Instead of BUILDS, I can solve this with JS executed in the popup.
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.
Tim (EC Software Documentation & User Support)
Private support:
Please do not email or PM me with private support requests -- post to the forum directly.