PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

  • Overview
  • What is a PHP site?
  • How to?
  • Creating a PHP project
  • The PHP RAD
  • Typing code in PHP
  • Test of a PHP project
  • Deploying a PHP site
  • PHP pages with or without context
  • For the PHP pages without context
  • Limitations
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview

What is a PHP site?

A PHP site is a site entirely compiled in PHP.
A PHP site corresponds to ".php" pages generated from WEBDEV. This type of site requires a PHP engine in order to be run.
This type of site can handle a database. See Handling data files in PHP for more details.
Why develop a PHP site with WEBDEV?
For some sites (especially small ones), it may be useful to develop these sites in PHP in order for them to be hosted at no extra cost. When deploying a PHP site, the WEBDEV engine is not required but a PHP engine must be installed on the server.
Principle for generating a PHP site with WEBDEV
WEBDEV allows you to generate a PHP site without even knowing the PHP language. The site is developed in WLanguage like any other WEBDEV site.
You also have the ability to directly enter your PHP code.
A syntactic and lexical analysis is now available for the PHP code (and for the Javascript code).
When generating the pages, the WEBDEV pages and the WLanguage functions are automatically converted into PHP pages.
Note: Minimum version required:
  • PHP 4 servers: PHP version 4.3.2 (or later) is required.
  • PHP 5 servers: The PHP sites generated by WEBDEV can also be used by PHP servers version 5. The minimum recommended version is version 5.2.1.
  • Versions 21 and later
    PHP 7 servers: The PHP sites generated by WEBDEV can also be used by PHP servers version 7. The minimum recommended version is version 7.0.22.
    New in version 21
    PHP 7 servers: The PHP sites generated by WEBDEV can also be used by PHP servers version 7. The minimum recommended version is version 7.0.22.
    PHP 7 servers: The PHP sites generated by WEBDEV can also be used by PHP servers version 7. The minimum recommended version is version 7.0.22.
  • A MySQL database is optional.
How to?

Creating a PHP project

When creating a project, the wizard asks you to choose the type of site to build. All you have to do is select "Dynamic PHP site" and follow the wizard. Once your project is created, you develop in WLanguage like for any WEBDEV site.
Note: The number of WLanguage functions that can be used in a PHP project is limited in this version. This number of functions will increase in the forthcoming versions.
The type of generation for an existing project can be modified in the description window of the project ("Project .. Project description"). The type of dynamic site can be modified: dynamic WEBDEV site or dynamic PHP site.The type of generation for an existing project can be modified in the description window of project (on the "Project" pane, in the "Project" group, click "Description"). The type of dynamic site can be modified: dynamic WEBDEV site or dynamic PHP site.
As soon as the project is configured like a PHP project, all the tools available in WEBDEV are automatically configured for the PHP project:
  • The window RAD or the full application RAD is specific to a database handled by a PHP site.
  • The compilation of the project indicates whether your project contains functions or controls that cannot be used in PHP. A purple message is displayed in the "Compilation errors" pane.
  • The generation of pages generates the pages in ".php" format
Note: We recommend that you create a new PHP project to develop a PHP site rather than transform a WEBDEV site into a PHP site.

The PHP RAD

Like for any WEBDEV project associated with an analysis, the RAD can be used to generate the pages of your PHP site.
You have the ability to create form pages, table pages, ... The PHP RAD takes into account all the specific features of the PHP generation (controls, processes, functions that can be used in a WEBDEV site generated in PHP).
The pages generated by the PHP RAD are using the SQL and HFSQL functions of WLanguage. The connection to the database is performed by SQLConnect via ODBC.

Typing code in PHP

The codes run on the server are represented by a Yellow or Pink bar in the code editor.
  • Yellow bar = WLanguage: the WL symbol is displayed in front of the code.
  • Pink bar = PHP: the PHP symbol is displayed in front of the code.
To switch from yellow code (WLanguage) to pink code (PHP), all you have to do is click the "WL" symbol found in front of the code (and conversely by clicking "PHP"). When saving the PHP page, the WLanguage code is automatically converted into PHP code.

Test of a PHP project

During the GO of a PHP project, the current directory is "<ProjectName>_WEB" and not the "EXE" directory automatically created when a PHP project is created.

Deploying a PHP site

The deployment of a PHP site is performed by WDDeploy.
Caution: To deploy a PHP site, the directory of sessions must be found and defined at the hosting company.
PHP pages with or without context
Two types of PHP pages can be generated:
  • the PHP pages with context. In this mode, the global variables are shared among all the project pages. By default, the PHP pages are created with context ("PHP generation with context" in the description window of the page).
  • the PHP pages without context. In this mode, the information must be transmitted between the pages via cookies or via the parameters of a command line.
Versions 15 and later

For the PHP pages without context

The "Initialization process of the project" can be run before the "Global declarations" process of the page. Therefore, the declaration of global variables or the opening of a database connection can be centralized in the initialization process of project.
Caution: The global variables will be reinitialized whenever the page is displayed or refreshed.
To get this operating mode, you must:
  1. Display the description window of the page ("Page .. Description").Display the description window of the page (on the "Page" pane, in the "Edit" group, click "Other actions" and select "Page description").
  2. In the "General" tab, check "Run the code of the PHP project at each display".
Notes:
  • In a project issued from WEBDEV 14 (or from an earlier version), this option is not enabled by default.
  • In a new WEBDEV PHP project (from version 15): by default, the created pages are pages with context.
  • When converting a WEBDEV AWP page or a dynamic page into PHP (from version 15), this option is enabled by default to maximize the compatibility.
New in version 15

For the PHP pages without context

The "Initialization process of the project" can be run before the "Global declarations" process of the page. Therefore, the declaration of global variables or the opening of a database connection can be centralized in the initialization process of project.
Caution: The global variables will be reinitialized whenever the page is displayed or refreshed.
To get this operating mode, you must:
  1. Display the description window of the page ("Page .. Description").Display the description window of the page (on the "Page" pane, in the "Edit" group, click "Other actions" and select "Page description").
  2. In the "General" tab, check "Run the code of the PHP project at each display".
Notes:
  • In a project issued from WEBDEV 14 (or from an earlier version), this option is not enabled by default.
  • In a new WEBDEV PHP project (from version 15): by default, the created pages are pages with context.
  • When converting a WEBDEV AWP page or a dynamic page into PHP (from version 15), this option is enabled by default to maximize the compatibility.

For the PHP pages without context

The "Initialization process of the project" can be run before the "Global declarations" process of the page. Therefore, the declaration of global variables or the opening of a database connection can be centralized in the initialization process of project.
Caution: The global variables will be reinitialized whenever the page is displayed or refreshed.
To get this operating mode, you must:
  1. Display the description window of the page ("Page .. Description").Display the description window of the page (on the "Page" pane, in the "Edit" group, click "Other actions" and select "Page description").
  2. In the "General" tab, check "Run the code of the PHP project at each display".
Notes:
  • In a project issued from WEBDEV 14 (or from an earlier version), this option is not enabled by default.
  • In a new WEBDEV PHP project (from version 15): by default, the created pages are pages with context.
  • When converting a WEBDEV AWP page or a dynamic page into PHP (from version 15), this option is enabled by default to maximize the compatibility.
Limitations
The following elements are not available in PHP generation:
  • the Unicode string.
  • the "GOTO" statement.
  • the Object-Oriented Programming (OOP).
  • the management of reals is more precise in WLanguage than in PHP (the number of decimals used in PHP is less than the number of decimals used in WLanguage).
Several WLanguage functions are available. See Functions available in PHP for more details.
Only the Latin character set 1 (ISO-8859-1) is supported, which includes the following languages: Albanian, German, English, Basque, Catalan, Danish, Scottish Gaelic, Spanish, Faroese, Finnish (except for the Š and š characters), French (except for the Ÿ, œ and Œ characters), Icelandic (except for the „ and " characters), Irish Gaelic, Italian, Dutch, Norwegian, Portuguese, Romansh and Swedish. The Afrikaans and the Swahili are also supported.
Note: Minimum version required:
  • PHP 4 servers: PHP version 4.3.2 (or later) is required.
  • PHP 5 servers: The PHP sites generated by WEBDEV can also be used by PHP servers version 5. The minimum recommended version is version 5.2.1.
  • A MySQL database is optional.
Related Examples:
WW_PayPal_PHP Training (WEBDEV): WW_PayPal_PHP
[ + ] This PHP example, powered by WEBDEV, explains how to propose a secured payment with the PayPal solution in your WEBDEV PHP sites.
It explains how to:
- include a PayPal payment button in a page,
- specify the payment information to PayPal,
- define a page for validating the payment,
...
WW_Forum_PHP Complete examples (WEBDEV): WW_Forum_PHP
[ + ] This example proposes the main features of a user forum (creation of forums, topics and messages, moderator, search, etc.)

Some of the features used by WW_FORUM_PHP:
- Rich control
- AJAX
-...
WW_Blogs_php Complete examples (WEBDEV): WW_Blogs_php
[ + ] This example is a PHP site created with WEBDEV for managing blogs.
A blog is a log or a diary on an Internet site.
It can be consulted by everyone and everyone can write his own comments.
The author of the blog writes messages whenever he wants to.
You have the ability to format the text, to include images, notes, and so on.
Furthermore, each blog can be exported in RSS.
WW_Association_PHP Complete examples (WEBDEV): WW_Association_PHP
[ + ] This example presents an associative site in WEBDEV PHP.
This site includes 2 main sections:
- the visitor section, accessible to all.
- the management section, reserved to the members of the association.  
 
This site is used to present the news, the photo galleries, the presentation of the association...
The members of the association can manage their news, their photos, exchange some messages and access the classified adverts...
The administrator manages the site as well as the members of the association.
Minimum required version
  • Version 9
Comments
Click [Add] to post a comment