Delphi PHP

Thursday, June 8, 2017

Lazarus Build Applications and Form

Lazarus Pascal Build Applications and Form

Lazarus How to Change the Applications Icon

1. Download in install component ColorPalette into Lazarus (ColorPalette Wiki)
2, Download and Run Lazarus Image Editor (Lazarus Image Editor Wiki)

Lazarus Change Form Icon

On Restricted Icon


Click Load on Lazarus Icon dialogue

Lazarus switch view Form and Unit Editor

Project => Shift+F12

Lazarus Maximize Windows size or Maximize Main Form during Run Time

Code on activated event below

procedure TMainForm.FormActivate(Sender: TObject);
begin
  //MainForm.Height:=screen.Height;
  //MainForm.Width:=screen.Width;
  //MainForm.Position:=poDesktopCenter;
  Windowstate:=wsMaximized;

end; 

Monday, October 20, 2008

How to Setup Delphi for PHP work for smarty template

1. Change code in php.ini as follow
; Windows: "\path1;\path2"
include_path = ".;c:\php\includes; c:\www\home\libs\Smarty-2.6.18\libs"

2. at MyComputer => Properties => Advances => Environment Variables
Create 2 Variable name
- Variable Name: TEMP => Variable Value : %USERPROFILE%\Local Settings\Temp
- Variable Name: TMP => Variable Value : %USERPROFILE%\Local Settings\Tmp

3. Change code C:\Program Files\CodeGear\Delphi for PHP\2.0\vcl\smartytemplate.inc.php
if ( preg_match( "/^WIN/i", PHP_OS ) )
{
/* if ( isset( $_ENV['TMP'] ) )*/
if (getenv( 'TMP' ))
{
/*$this->_smarty->compile_dir = $_ENV['TMP'];*/
$this->_smarty->compile_dir = getenv( 'TMP' );

}
/*elseif( isset( $_ENV['TEMP'] ) )*/
elseif (getenv( 'TEMP' ))
{
/*$this->_smarty->compile_dir = $_ENV['TEMP'];*/
$this->_smarty->compile_dir = getenv( 'TEMP' );
}
else
{
$this->_smarty->compile_dir = '/tmp';
}
}
else
{
$this->_smarty->compile_dir = '/tmp';
}

$this->_smarty->cache_dir=$this->_smarty->compile_dir;

These process make me got work well with Delphi for PHP smarty template

Thursday, October 2, 2008

Delphi for PHP Calculator with AJAX

I would like to use delphi for php create AJAX form, which I create web calculator to test this. Mention to step how to following as below.
1. create form



2. setup at form properties UseAjax => True


3. Code at each button even as follow
function Button4Click($sender, $params)
{
$this->Label1->Caption = "Result: ". ($this->Edit1->Text /
$this->Edit2->Text);


}

function Button3Click($sender, $params)
{
$this->Label1->Caption = "Result: ". ($this->Edit1->Text *
$this->Edit2->Text);


}

function Button2Click($sender, $params)
{
$this->Label1->Caption = "Result: ". ($this->Edit1->Text -
$this->Edit2->Text);


}

function Button1Click($sender, $params)
{
$this->Label1->Caption = "Result: ". ($this->Edit1->Text +
$this->Edit2->Text);


}
4. Coding Javascript even in each button code as below
function Button4JSClick($sender, $params)
{
echo $this->Button1->ajaxCall("Button4Click");
?>
//Add your javascript code here
return(false);

}

function Button3JSClick($sender, $params)
{
echo $this->Button1->ajaxCall("Button3Click");
?>
//Add your javascript code here
return(false);

}

function Button2JSClick($sender, $params)
{
echo $this->Button1->ajaxCall("Button2Click");
?>
//Add your javascript code here
return(false);

}

function Button1JSClick($sender, $params)
{
echo $this->Button1->ajaxCall("Button1Click");
?>
//Add your javascript code here
return(false);

}
5. get result here

Fist Web with Delphi for PHP

This is first application test for Delphi for PHP.
Hello word
1.First Step create form put the component as below.


2. No need any change for the component properties
3. Coding Button1 Even Delphi for PHP code as below
function Button1Click($sender, $params)
{
$this->Label1->Caption= "Hello: ".$this->Edit1->Text;


}
4. Hello word result for first web by Delphi for PHP

Tuesday, January 1, 2008

Why Delphi PHP

7 reasons why we need Delphi PHP
1. No need to learn PHP scrip
2. Easy to build PHP web form
3. Easy for variety database connection
4. Cheap web host support PHP
5. Easy for web application developer
6. Easy to connect free MySQL database
7. Friendly with Delphi and .Net programer