ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Web-specific functions / Page functions
  • Retrieving parameters in the "Global declarations" event
  • Retrieving the parameters with PageParameter
  • Principle for opening a page
  • Operations run when the page is displayed
  • Special cases
  • Opening a page of a component
  • Pre-launched sessions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Displays a web page in the user's browser.
WEBDEV - Server code The displayed page can be:
  • a static WEBDEV page,
  • a page in Session mode,
  • an Active WEBDEV Page.
WEBDEV - Browser code The displayed page can be:
  • a static WEBDEV page.
  • an Active WEBDEV Page. To display an Active WEBDEV Page while passing parameters, use FileDisplay.
  • an SEO-ready page in Session mode.
PHP The page displayed is another PHP page of the project.
Remarks:
  • If <Page>.Display is used in the code of a Button control, the page will be opened in the target defined for this Button control ("General" tab of the control description or ChangeTarget).
  • To display any page in a browser, use one of the following functions: BrowserRunApp or BrowserOpen.
Example
WEBDEV - Server codePHP
// Display a page according to the authorization
IF bAuthorize(Name) THEN
PAGE_Welcome.Display(Name)
ELSE
PAGE_Error.Display("Access denied")
END
WEBDEV - Server code
// In "PAGE_MyPage.AWP", displays the 150th element
// of "Instruments" category
PAGE_MyPage.Display("Instruments", 150)
// Displays a static page in the current frame
PAGE_PAGESTATIC.Display()
Syntax
WEBDEV - Server codePHP
<Page>.Display([<Parameter 1> [... [, <Parameter N>]]])
<Page>: Page name
Name of page to display.
In test mode, specify the full path of the page if the page to open is located in a directory other than the project directory.
<Parameter 1>: Type of value sent to the page (optional)
Parameters expected by the opening process of the page to display. These parameters are passed by reference and are considered as global variables to the page. For an AWP or PHP page, these parameters are converted into string.
<Parameter N>: Type of value sent to the page (optional)
Parameters expected by the opening process of the page to display. These parameters are passed by reference and are considered as global variables to the page. For an AWP or PHP page, these parameters are converted into string.
In the environment, when defining the action of a button or link, you have the ability to select the page to display to avoid programming <Page>.Display in the click code. You also have the ability to define the parameters passed to the page by clicking the "Parameters" button.
The parameters can also be defined as:
  • Fixed value,
  • Reference to a page control,
  • Reference to a variable.
WEBDEV - Browser code
<Page>.Display([<Destination> [, <Browser window> [, <Options> [, <Width> [, <Height> [, <Horizontal position> [, <Vertical position> [, <JavaScript parameters>]]]]]]]])
<Page>: Page name
Name of page to display.
<Destination>: Optional character string or constant
Name of the target frame or alias of the target iFrame control.
<Target> can also take the following values:
CurrentBrowserthe target is the current browser.
This parameter can also correspond to the "_top" string (compatibility with WEBDEV 1.5).
CurrentFramethe target is the current frame (default value).
This parameter can also correspond to the "_self" string (compatibility with WEBDEV 1.5).
NewBrowserthe target is a new browser (a new browser window is opened). The following parameters of <Page>.Display are used to configure this new window.
This parameter can also correspond to the "_blank" string (compatibility with WEBDEV 1.5).
ParentFramethe target is the container of the current page (parent frameset, parent browser).
This parameter can also correspond to the "_parent" string (compatibility with WEBDEV 1.5).
<Browser window>: Optional character string
Window name in the new browser if <Target> is set to the NewBrowser constant. This parameter allows you to redisplay a page in a browser with the same name (if several browsers are opened on the computer of Web user).
<Options>: Optional Integer constant (or combination of constants)
Parameters of the window in the new browser if <Target> is equal to the NewBrowser constant:
ONFull
(Default value)
The new browser window will include all options (equivalent to the combination of all constants)
ONLinkThe link bar will be displayed
ONLocationThe address bar will be displayed
ONMenuBarThe menu bar will be displayed
ONResizableThe new browser window will be resizable
ONSatusBarThe status bar will be displayed
ONScrollbarThe scrollbars will be displayed
ONSimpleThe window of the new browser will be a simple window (no combination of constants).
ONToolbarThe toolbar will be displayed
<Width>: Optional integer
Width of window in the new browser (in pixels).
<Height>: Optional integer
Height of window in the new browser (in pixels).
<Horizontal position>: Optional integer
Horizontal position (in pixels) of the window in the new browser (in relation to the upper-left corner of the screen).
<Vertical position>: Optional integer
Vertical position (in pixels) of the window in the new browser (in relation to the upper-left corner of the screen).
<JavaScript parameters>: Optional character string
Other JavaScript parameters that must be used when opening a new browser if <Target> is equal to the NewBrowser constant.
Remarks
WEBDEV - Server codePHP

Retrieving parameters in the "Global declarations" event

To retrieve parameters in the "Global declarations" event of the page, specify the following line at the beginning of the code:
PROCEDURE <Page name> (<Parameter 1> [, ...[, <Parameter N>]]])
These parameters can be strings, reals or integers. The parameters retrieved in the "Global declarations" event of the page are character strings (AWP and PHP pages only)
WEBDEV - Server codePHP

Retrieving the parameters with PageParameter

PageParameter is used to retrieve the value of the parameters passed to the page. Several possibilities exist according to the type of page:
  • Getting the parameter using its name
    The name of the parameter was specified in the URL of the page.
    For an AWP or PHP page, the parameters are automatically renamed by WEBDEV (P1, P2, ..., P256). In this case, no controls named P1, P2, ..., P256 must be found in the page.
    1. Code used to display the page by passing parameters:
      // In the "MyPage.AWP" page, displays the 350th element
      // of "Instruments" category
      PAGE_MyPage.Display("Instruments", 350)
    2. Code used to retrieve the parameters:
      // Retrieve the parameters
      SoughtCategory is string = PageParameter("P1")
      SoughtID is int = PageParameter("P2")
  • Getting the parameter using its index
    The index of the parameter corresponds to the order in which the parameters were passed in the URL of the page.
    1. Code used to display the page by passing parameters:
      // In the "PAGE_MyPage.AWP" page, displays the 350th element
      // of "Instruments" category
      PAGE_MyPage.Display("Instruments", 350)
    2. Code used to retrieve the parameters:
      // Retrieve the parameters
      SoughtCategory is string = PageParameter(1)
      // SoughtCategory = "P1=Instruments"
      SoughtCategory = Right(Length(SoughtCategory)-3)
      SoughtID is int = PageParameter(2)
      // SoughtID = "P2=350"
      SoughtID = Right(Length(SoughtID)-3)
WEBDEV - Server codePHP

Principle for opening a page

<Page>.Display does the following:
  • Create a page context on the server (except when displaying PHP pages).
  • Return the page to the browser of web user.
PHP <Page>.Display returns only the page in the user's browser.
WEBDEV - Server codePHP

Operations run when the page is displayed

The following operations are run when the page is displayed:
  • Running the "Global declarations" event of control templates and internal pages.
  • Running the "Global declarations" event of the page.
  • Intialization on the direct child controls of the page (and recursively on the page controls and objects):
    • Declaration code of variables (if it exists and if it was not run yet: page, supercontrol, popup, ...).
    • Intialization of direct children.
    • Request for refreshing the display code (if it exists).
    • Initialization code (if it exists).
  • For all page controls (according to a browse in depth):
    • Filling the control (for the List box, Combo box, Table or browsing Looper controls)
    • End of initialization code (if it exists).
  • Running the "Request for refreshing the display" event of the page (if it exists).
  • Running the "Initialization" event of the page.
Furthermore, for a page that inherits from a template, the code of template(s) is run just before the page code. For the controls that inherit from a template, ExecuteAncestor must be used to call the template code (except for the declaration code).
WEBDEV - Server codePHP

Special cases

  • To redisplay a page, it is recommended to use <Page>.Refresh.
  • To take a change of language into account (Nation), use <Page>.Use.
  • If a page context with the same name already exists, it is deleted (and its closing code is run) before the new one is opened.
  • To display any page (not necessarily found in the site), use BrowserOpen for example.
WEBDEV - Server code

Opening a page of a component

To open a page of a component, use the name of the component page (the component being included in the project). For example:
ComponentPage.Display()
If a conflict occurs with a project element, the name of the element must be prefixed by the name of the component. For example:
MyComponent.MyPage.Display()
To use the name of the page in a variable, specify the name of the component. For example:
sPage is string = "MyComponent.MyPage"
sPage.Display()

Pre-launched sessions

If your project uses pre-launched sessions, this function must not be used in the project initialization event. This function must be used in the "Initialize project after connecting to the site" event.
Component: wd300page.dll
Minimum version required
  • Version 24
Comments
Click [Add] to post a comment

Last update: 06/21/2023

Send a report | Local help