ixRad for PHP Help
-
Runtime library:
-
The IDE needs .NET to run. If you don'nt have .NET runtime on your system
installed,
get it from Microsoft. It is the new runtime for Visual Basic, C#,
Delphi.NET, Eiffel.NET ...etc. You need .NET design-time only. Your
generated PHP web application DOES NOT NEED Microsoft .NET
to run on the webserver.
-
Internet Explorer 5 or higher must be installed on the system.
-
ixRad:
-
Unzip the whole folder structure to a folder, where you like. Make a
command-icon to the exe if you prefer. No other setup is needed.
-
PHP, Webserver & DBMS
-
You need PHP5. PHP4 doesn't
handles object references as expected.
-
Make sure your development webserver is up and running.
-
Start your DBMS, like MySQL, if you like. IXRad basicly doesn't need it to run,
except you use MySQLDataGrid.
Post-installation setup
-
Create a root directory for your app, in a directory, where your webserver can
serve it.
-
Copy here the following directories with content, preserving the tree
structure:
-
images
-
lib
-
styles
-
templates
-
Start IXRadPhp.exe
-
Click Load button, and select '010 Hello World.prp'
-
Click right in the Object Tree: Web Application, then click Properties
button (with check icon)
-
Fill in then all fields according your system.
Server URL is the URL of the Web App Absolute Local Path as your
development webserver serves + /web_app_filename.php
-
Click OK
-
Click Save, Build, Run: the running Web Application should
appear in Internet Explorer. If not, check your test webserver, and application
settings.
-
To re-launch application, you need to close and re-start the browser.
-
Examine the other Demo Applications in increasing order.
-
Close and restart IXRadPhp.exe.
-
Repeat the steps as by the Demo App except Load. Make sure Web Application
settings are correct. Save your new project under Menu-File-Save project as.
-
Select Web Application in the Object Tree.
-
Click Add Form button.
-
Click the New form in the Object Tree.
-
Click Add Control Button.
-
In the ToolBox double-click Button. Repeat with TextBox; they
sould appear as children of NewForm.
-
Click Button in the Tree and click Properties button. Rename it to Button1
in PHP Name. Text will be Hello. Click Done.
-
Click TextBox in the Tree and click Properties button. Rename it to
TextBox1 in PHP Name. Text will be empty. Click Done.
-
Select NewForm, click Properties button. Rename it to Form1.
Note the layout is grid.
-
Select Form1, click Designer button. Drag & Resize the controls
you like. No other operations supported here currently. If you overwrite the
captions or make other things they doesn't take effect in the app. Click OK.
-
Select Form1, click View Code button.
-
Type in, (pay attention to case):
function Button1Click() {
$this->TextBox1->Text = 'Hello!';
}
-
This is an event handler. Simply the function's name binds it to the event.
-
Click Save, Build, Run. Try it.
-
Close the browser every time before new start, it creates a new session.
-
Now you can experiment with the app. Appearance of controls is controlled
through CSS. E.g. set Button1 Inline Style to: background-color:red;
font-weight:bold;
In the application there is only one instance $App object instance
of MyApplication class (inherited from Application base class).
It holds all forms that you created as class member variables
and in the $Forms array too.
All IDE created controls are member variables of the
corresponding form.
Container type objects like Form and Panel have the
Controls array holding references to paint children. The IDE fills it according
the object tree. It can be manipulated runtime too, see Menu example project.
Controls are accessed from the same form so:
$this->MyControl
From other forms: $this->AppRef->OtherForm->OtherControl (note that
every form holds an AppRef reference to the one $App object).
Variables, that you declare in the Form Code are form class
members. Never forget to acces these from inside form's functions so:
$this->MyVariable. Variables inside Web Application Code, are
Application class members.
Forms member variables and Application member variables automatically retain
values througout the session. This is one essence of ixRAD. $_SESSION
array usage and other forms of session variables provided by PHP are possible,
short, but not elegant; you can create an Application or Form member
variable array instead.
You create your own class definitions in modules.
Its instance variables should be somewhere in the $App tree structure( e.g.
member variable of $App or a $Form ), to preserve it through the session. See
UserClass example project.
External classes should be included on
the Web App Property Page. Then threat them as classes in a module.
Any class can be instantiated runtime too.
Any class instance's property that was set by the designer, can be later
manipulated runtime.
The IDE stores all form's code and design and web app settings in one project
file.
The IDE generates only one output php file -it contains the whole web
app. Look at the Web App Property Page. The lib subdirectory with the
runtime and the cortrols sould be placed beneath.
All forms have a layout either:
Grid layout
Controls are absolutely positioned
Template layout
-
The controls designed in the IDE are placed inside a HTML template.
-
The template MUST have a <form method="post"> tag at the beginning and a
</form> at the end (inside BODY).
-
Placeholders are replaced to Controls runtime by the system. The placeholder is
a <PRC_ControlName></PRC> tag-pair.
Example <PRC_Panel2>anything here will be replaced by Panel2</PRC>
-
Template filename is set in the IDE, under Form properties.
All containers - like Panel - have layouts too.
Grid-Layout
Flow-Layout
Create the control's PHP code.
-
Study the built-in controls.
-
It must have a GetPaint() method returning the html runtime current
representation of your control.
-
GetPaint() must use the following methods:
$this->GetDefaultStylePosition()
$this->GetDefaultStyleSize()
They ensure proper location and size governed by the system
-
Give the control an unique name, beginning with your initials.
-
Inherit it from Forms_Control
-
Create event handling and user input as necessary; study the system controls.
More info later ...
-
Place the control in a file having its name. Drop it to /lib subdirectory.
Create Design info the simple way
-
You create an XML section of design info representing your control design-time.
-
Study the built-in control's XML, they are in the WebComponents subdir
Installed.xml file.
-
Paste your xml there too.
-
The simple nodes hold base properies. Followining nodes are mandatory:
PhpRequire: in this file sits the runtim php code of your
component
PhpType: the unique php class name of your component.
Begin it with your initials.
PhpBaseName: for non-system components sould be
the same string as PhpType.
PreCode: the HTML code of your app in the designer. The
system replaces the [[xxx]] placeholders with the corresponding node's value,
as the user modified it in the property pages and the designer.
-
The ExtraProps
node contains the Props node, wich holds an array of <DynamicItem>s. The
user can modify the value of the <Value> subnode - as Extra
Properties - on the Control's Property Page. These values will be replaced
in place of the[[ExtraProps_xxxx]] placeholders in the PreCode node, where xxxx
is the <key> subnode of the <DynamicItem>. On Build the system
compiles in the PHP code these values as initial values for the
corresponding PHP member variable. E.g if you have an Extra Property with
<key> of 'Brightness' then you must have a $Brightness member of
your component, and this will receive the user edited value as its initial
value.
-
More info later ...
Create Design info the advanced way
-
You create the same XML and paste it, but it has another syntax. See TextTable
example.
-
You create an External Property Page application.
-
The system startes it as the user presses the PropertyPage button of the
Control, on the Control's properties tab.
-
It receives the control's current state from the IDE through
clipboard.
-
It creates the valid html for the control, as it appears in the IDE Designer.
-
It creates the data for the runtime PHP component. It can be any data in
string format. The data represents the User's setting for the control.
-
It passes the control design state and the runtime data to the system.
-
The system passes the runtime data on Build into your PHP component. Your
component recives the data in his $PPRuntimeData variable and uses it to
represent the User's design-time settings.
-
There is an example TextTable PP application's source written in .NET. This
example is a bit slow, because of serializing/deserializing a whole DataSet; it
can be made much faster.
Any other programming language can be utilized, as the communitation
is thru clipoard.
A more comprehensive documentation is coming soon.
Go to the support forum to discuss usage, faq, programming.
http://prog.hbnet.hu/dev/php/IXRAD
Submit your created components or your webpage where you provide components for
ixRAD.
Look at the component reference too.