HTML Kit site requirements.

HTML editor / Support Document
HomeHTML-Kit downloadsAdd-ins that update and extend HTML-Kit's capabilitiesSoftware and authoring support channelsRegister -- download add-ons and support HTML-KitOnline tools for HTML-Kit users
 

Support Document

 Home > Support > Support Documents > Plugins > How to: Write page wizards
 
 
How to: Write page wizards
The information in this document applies to:
 Summary

This document describes how to write page wizard plugins that can be used to generate basic page templates, files for framesets, and other types of initial pages.
 
 Details

Starting with HTML-Kit Build 292 and higher, it's possible to create page wizard plugins which will appear on the "File | New from Page Wizards" menu. This feature can be used to create advanced page template generators and other types of file generators.

Following sample plugin demonstrates how to add a page wizard that can create a simple web page. Paste the following code into a file named demoPageWizard.hks and install it using the "Tools | Install | Plugin" main menu option. To test the plugin, select it from the "File | New from Page Wizard" menu.

--- cut here ---
function hkp_Register(pDataIn, pDataOut)
{
  hkp_DataSetGlobalSuffix("_1");

    // name of the plugin (must be unique)
  hkp_DataAdd(pDataOut, "NAME", "demoPageWizard");

    // no need to show a button on the ActionsBar
  hkp_DataAddInt(pDataOut, "BUTTON_VISIBLE", 0);

    // editor not required
  hkp_DataAddInt(pDataOut, "MODE_EDITOR_REQUIRED", 0);

    // wizard menu item caption
  hkp_DataAdd(pDataOut, "TEMPLATEWIZARD_CAPTION", "Create a simple web page...");

    // some help text
  hkp_DataAdd(pDataOut, "TEMPLATEWIZARD_HINT", "Simple page wizard plugin.");

    // request template wizard events
  hkp_DataAddInt(pDataOut, "TEMPLATEWIZARD_EVENT_ONINVOKE", 1);

  hkp_DataSetGlobalSuffix("");
}

function hkp_Main(pDataIn, pDataOut)
{
    // is this a template wizard event?
  if( 1500 == hkp_DataGetInt(pDataIn, "EVENT", 0) )
  {
    var sHTML =
      "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n\n" +
      "<html>\n<head>\n<title>|Untitled</title>\n</head>\n<body>\n\n";

      // modify the template based on user input.
    if(6 == MessageBox("Do you want to display the modified date?", "Confirm", 4) )
    {
      sHTML += "<p>Modified on " + gettime( "DD-MMM-YYYY" ) + "</p>\n\n";
    }

    sHTML += "</body>\n</html>\n";

      // send output to a new window
    hkp_DataAdd(pDataOut, "OUTPUT", sHTML);
    hkp_DataAddInt(pDataOut, "MODE_OUTPUT", 7);
    hkp_DataAddInt(pDataOut, "MODE_MOVE_TO_CARET", 1);
  }
  else
  {
      // no output
    hkp_DataAddInt(pDataOut, "MODE_OUTPUT", 1);
  }
}
--- cut here ---
 
 
 
Document ID: H000144
Reviewed On: 27-Mar-2002
THE INFORMATION IN THIS DOCUMENT IS PROVIDED ON AN AS-IS BASIS WITHOUT WARRANTY OF ANY KIND. PROVIDER SPECIFICALLY DISCLAIMS ANY OTHER WARRANTY, EXPRESS OR IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL PROVIDER BE LIABLE FOR ANY CONSEQUENTIAL, INDIRECT, SPECIAL OR INCIDENTAL DAMAGES, EVEN IF PROVIDER HAS BEEN ADVISED BY "USER" OF THE POSSIBILITY OF SUCH POTENTIAL LOSS OR DAMAGE. "USER" AGREES TO HOLD PROVIDER HARMLESS FROM AND AGAINST ANY AND ALL CLAIMS, LOSSES, LIABILITIES AND EXPENSES.