Web Libraries

iScripts use the existing PeopleCode Function Library infrastructure. However, instead of naming your record FUNCLIB_xxx, all iScripts must be contained in records named WEBLIB_xxx. All of the existing tools and techniques for working with function libraries (such as Upgrade, Find In, Rename, and so on) also apply to Web Libraries.

See Accessing PeopleCode External Functions.

To create an iScript:

  1. Create or extend a domain specific WEBLIB (funclib).

    WEBLIBs are derived/work record definitions that have their name prefixed with WEBLIB_.

  2. Add a function to a WEBLIB.

    The name of your function must be prefaced with IScript_. For example:

    IScript_HelloWorld
    
    IScript_FuncHRPage

Note: iScript functions take no arguments, and do not return a value.

The following iScript writes data.

Function IScript_HPDefaultCategories() 
    
   &ClearDotImage = %Response.GetImageURL(Image.PT_PORTAL_CLEAR_DOT); 
   &CatHTML = GetHTMLText(HTML.PORTAL_HP_CATEGORY, &ClearDotImage, GetCategories()); 
   %Response.Write(&CatHTML); 
 
End-Function;

The following iScript uses both the request and response objects to echo what the user types into an edit control.

Image: Example iScript

This example illustrates the fields and controls on the Example iScript. You can find definitions for the fields and controls later on this page.

Example iScript
Function IScript_HelloWorld() 
 
%Response.WriteLine("<html><head><title>Hello World</title></head><body>"); 
   %Response.WriteLine("<h1>Hello World</h1>"); 
   %Response.WriteLine("<form method=POST action = " | %Request.FullURI | "?" | %Request.QueryString | "><input type=submit value='Say this!'>&nbsp<input type=edit name=WhatYouSaid value=" | %Request.GetParameter("WhatYouSaid") | "></form>"); 
    
   rem echo back what the user typed into the edit box...; 
   %Response.WriteLine("<p><font face='Arial, Helvetica' size='5' color='blue' >You said: "); 
   %Response.WriteLine(%Request.GetParameter("WhatYouSaid")); 
    
   %Response.WriteLine("</body></html>"); 
   Return; 
End-Function;