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 PageDisplay 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
PageDisplay(PAGE_Welcome, Name)
ELSE
PageDisplay(PAGE_Error, "Access denied")
END
WEBDEV - Server code
// In "PAGE_MyPage.AWP", displays the 150th element
// of "Instruments" category
PageDisplay(PAGE_MyPage, "Instruments", 150)
// Displays a static page in the current frame
PageDisplay(PAGE_STATICPAGE)
// Displays any page in the current frame
IF Nation() = nationEnglish THEN
PageDisplay("US/PAGE_Example.HTM")
ELSE
PageDisplay("FR/PAGE_Example.HTM")
END
// Displays a static page in a new resizable browser
// (500x400). This browser will be closed if the calling browser is closed.
sPageName is string = "STATICPAGE"
PageDisplay(sPageName, NewBrowser, ...
"NEWBRW", ONResizable + ONScrollBar, 500, 400, 10, 20, "dependent=1")
Syntax
WEBDEV - Server codePHP

Displaying a static page or a page in Session mode (non SEO-ready) Hide the details

PageDisplay(<Page> [, <Parameter 1> [... [, <Parameter N>]]])
<Page>: Page name
Name of page to display.
If this parameter is an empty string (""), the name of the page corresponds to the page to which the current process belongs.
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 PageDisplay 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

Displaying a static page or an Active WEBDEV Page Hide the details

PageDisplay(<Page> [, <Target> [, <Browser window> [, <Options> [, <Width> [, <Height> [, <Horizontal position> [, <Vertical position> [, <JavaScript parameters>]]]]]]]])
<Page>: Name of the page or character string
Name of page to display:
  • Static page of the project or Active WEBDEV Page:
    The name of the page is specified without extension. The page is displayed according to the project language parameters.
    Example: The following syntax is sued to display the static page named "CompanyPage":
    PageDisplay(CompanyPage)
  • Any HTML page found in the <Project name>_WEB directory (or in one of its subdirectories):
    The name of the page to display must correspond to the full path of the page starting from the <Project name>_WEB directory and it must include the extension of the file. In this case, the multilingual feature must be managed.
    Example: To display "C:\My Projects\MySite\MySite_WEB\Misc\HTMLPage.htm", use the following syntax:
    PageDisplay("Misc\HTMLPage.htm")
<Target>: 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 PageDisplay 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.
WEBDEV - Browser code

Displaying a page in SEO-ready session mode Hide the details

PageDisplay(<Page> [, <Parameter 1> [... [, <Parameter N>]]])
<Page>: Page name
Name of page to display. The page must be in SEO-ready session mode.
If this parameter is an empty string (""), the name of the page corresponds to the page to which the current process belongs.
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 PageDisplay 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.
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
      PageDisplay(PAGE_MyPage, "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
      PageDisplay(PAGE_MyPage, "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

PageDisplay 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 PageDisplay 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 PageRefresh.
  • To take a change of language into account (Nation), use PageUse.
  • 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:
PageDisplay(ComponentPage)
If a conflict occurs with a project element, the name of the element must be prefixed by the name of the component. For example:
PageDisplay(MyComponent.MyPage)
To use the name of the page in a variable, specify the name of the component. For example:
sPage is string = "MyComponent.MyPage"
PageDisplay(sPage)

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.
Business / UI classification: UI Code
Component: wd300page.dll
Minimum version required
  • Version 9
Comments
Video Page Display
https://youtu.be/TQoQuKxLELA
amarildo
26 Oct. 2018

Last update: 05/15/2023

Send a report | Local help