Launching a PHP controller
Launching a PHP controller from the Profound UI HTTP Server Instance
To launch a Profound UI PHP controller script using the Profound UI HTTP Server Instance on the IBM i, you must specify a path to the controller using the controller query string parameter on the start URL. Â For example:Â http://yourServer:8080/profoundui/start?controller=/php/profoundui/myscript.php. Â PHP must be enabled in the Profound UI Instance for this to work. Â Click here for details on how to enable PHP.
If default settings are used, the above myscript.php file would be stored in the /www/zendsvr/htdocs/profoundui IFS directory.
Profound UI uses its own start.html template in this scenario.
Launching a PHP controller outside of the Profound UI HTTP Server Instance
You may have the need to launch a Profound UI PHP controller outside of the HTTP Instance shipped with Profound UI. Â Perhaps, you want to test the script on your local PC, copy the application to another platform, or package it as a native mobile application through the use of PhoneGap.
To accomplish this, we simply copy the necessary resources from the IFS. Â You will need at least the following files:
The starting HTML page can be copied from /www/profoundui/htdocs/profoundui/userdata/html/start.html.
The Profound UI CSS file can be copied from /www/profoundui/htdocs/profoundui/proddata/css/profoundui.css.
The Profound UI runtime JavaScript file can be copied from /www/profoundui/htdocs/profoundui/proddata/js/runtime.js.
It is acceptable to copy the above files into the same destination folder.
Some Profound UI widgets use images (located here: /www/profoundui/htdocs/profoundui/proddata/images) and potentially other resources shipped with Profound UI. Depending on which widgets your applications utilize, these resources must be copied in addition to the 3 files mentioned above. Â When you copy these, you must maintain the same directory structure in your destination environment. Â For example, images must be accessible via the relative URL /profoundui/proddata/images.
The start.html file must correctly point to the profoundui.css and runtime.js files. Â It will look something like this:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Profound UI Example - Running Locally</title>
<link href="profoundui.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="runtime.js"></script>
<script type="text/javascript">
window.onload = function() {
pui.start();
};
</script>
</head>
<body>
<div id="pui"></div>
</body>
</html>
You can launch the application from the destination environment by bring up the start.html file and passing the controller parameter. Â For example: http://localhost/start.html?controller=myscript.php. Â The example assumes that the myscript.php controller is located in the same directory as the start.html file.
You may choose to rename the start.html file to something else and hard-code the controller inside the HTML code. Â For example, if you rename start.html to index.html and change the code as illustrated below, you may be able to launch the application by simply using http://localhost.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Profound UI Example - Running Locally</title>
<link href="profoundui.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="runtime.js"></script>
<script type="text/javascript">
window.onload = function() {
pui.controller = "myscript.php";
pui.start();
};
</script>
</head>
<body>
<div id="pui"></div>
</body>
</html>
The only new line that was added is: pui.controller = "myscript.php";