If the file is found Help Builder will compile the file and load any functions/classes contained within it and make it available to your script pages. Help Builder will also execute a specific function at startup: HelpBuilder_Extension_Init(). This function is loaded called when Help Builder first starts after Help Builder has initialized but before a form is loaded.
Here's what the HelpBuilder_Extension.prg file might look like:
*** Custom Initialization Code FUNCTION HelpBuilder_Extension_Init() MessageBox("Hello this is my custom Initialization Code") ENDFUNC *** Custom functions that can be called from HTML Template pages *** <%= CopyRightNotice() %> FUNCTION CopyrightNotice() RETURN "(c) West Wind Technologies, " + TRANSFORM(YEAR(2005))
Note that the file uses Visual FoxPro code.
*** Custom Initialization Code FUNCTION HelpBuilder_Extension_Init() *** Load a compiled class or UDF library SET PROCEDURE TO MyExternalLibraryFunction in MyExternalLibrary.EXE ADDITIVE *** Load uncompiled PRG files and SET PROCEDURE TO CompileAndLoadHelpBuilderExtension( "someOtherLibrary.prg" ) *** Make a COM object globally visible to your templates PUBLIC oMyComObject __oMyComObject = CREATEOBJECT("MyComObject.Server") ENDFUNC
Note that you can make any objects or other variables PUBLIC in order to have them visible in your templates. I recommend if you do this, that you use a __ prefix to avoid any potential variable naming conflicts.