I have to lengthy scripts to run, and I need to now what´s happening while run. In browser I can see parts of results while PHP are running but in psvPHP I cant.
How can I make psvPHP send a partial result to a Memo for exemple?
Thanks anyone.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
var str : string;
Param : pzval_array;
begin
if ( not (zend_get_parameters_ex(1, Param) = SUCCESS )) then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
try
convert_to_string(param[0]^);
str:=param[0]^.value.str.val;
MainForm.Memo1.Lines.Add(Str); // add string to memo line
Application.ProcessMessages; // refresh display
finally
ZVAL_BOOL(return_value,true);
end;
end;
3.Add this function info to module php4delphi.pas :
procedure php_info_library(zend_module : Pointer; TSRMLS_DC : pointer); cdecl;
var
cnt : integer;
begin
php_info_print_table_start();
...
...
...
php_info_print_table_row(2, 'delphi_addline_to_memo', 'Dodaje linie do pola zaklady');
...
...
4. For new function Add Entry table in module delphi4php.pas :
procedure TPHPEngine.RefreshLibrary;
var
cnt : integer;
begin
SetLength(FLibraryEntryTable, FHash.Count + XX); // Add 1 to length entry table for new function
...
...
...
PHP_FUNCTION(FLibraryEntryTable[XX], 'delphi_addline_to_memo', @delphi_addline_to_memo);
...
end;
for display any line from your script use you new function in php code:
<?php
delphi_addline_to_memo("Hello world, this is begin of my script");
...
...
...
delphi_addline_to_memo("Hello world, this is end of my script");
?>
regards and sorry for my english :-(
Andrzej Kmicic
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Andrzej, thanks for you help. Your solution is fantastic, this will be very usefull, but I need this echo in runtime to monitor error messages coming from the script. Then I´m thinking in what happening in the browser when we run a long script.
Any way, thank you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have to lengthy scripts to run, and I need to now what´s happening while run. In browser I can see parts of results while PHP are running but in psvPHP I cant.
How can I make psvPHP send a partial result to a Memo for exemple?
Thanks anyone.
Hi
1. Copy DelphiFunctions.pas and php4delphi.pas from component folder to the your project folder and adding both to your main project.
2. Add to this module you new function eg :
// ----------------------------- delphi_addline_memoa
//add line to memo in runtime mode
{$IFDEF PHP510}
procedure delphi_addline_to_memo(ht : integer; return_value : pzval; return_value_ptr : ppzval; this_ptr : pzval;
return_value_used : integer; TSRMLS_DC : pointer); cdecl;
{$ELSE}
procedure delphi_addline_to_memo(ht : integer; return_value : pzval; this_ptr : pzval;
return_value_used : integer; TSRMLS_DC : pointer); cdecl;
{$ENDIF}
var str : string;
Param : pzval_array;
begin
if ( not (zend_get_parameters_ex(1, Param) = SUCCESS )) then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
try
convert_to_string(param[0]^);
str:=param[0]^.value.str.val;
MainForm.Memo1.Lines.Add(Str); // add string to memo line
Application.ProcessMessages; // refresh display
finally
ZVAL_BOOL(return_value,true);
end;
end;
3.Add this function info to module php4delphi.pas :
procedure php_info_library(zend_module : Pointer; TSRMLS_DC : pointer); cdecl;
var
cnt : integer;
begin
php_info_print_table_start();
...
...
...
php_info_print_table_row(2, 'delphi_addline_to_memo', 'Dodaje linie do pola zaklady');
...
...
4. For new function Add Entry table in module delphi4php.pas :
procedure TPHPEngine.RefreshLibrary;
var
cnt : integer;
begin
SetLength(FLibraryEntryTable, FHash.Count + XX); // Add 1 to length entry table for new function
...
...
...
PHP_FUNCTION(FLibraryEntryTable[XX], 'delphi_addline_to_memo', @delphi_addline_to_memo);
...
end;
for display any line from your script use you new function in php code:
<?php
delphi_addline_to_memo("Hello world, this is begin of my script");
...
...
...
delphi_addline_to_memo("Hello world, this is end of my script");
?>
regards and sorry for my english :-(
Andrzej Kmicic
Andrzej, thanks for you help. Your solution is fantastic, this will be very usefull, but I need this echo in runtime to monitor error messages coming from the script. Then I´m thinking in what happening in the browser when we run a long script.
Any way, thank you.
I´m trying to run this code but PHP can´t find the function. Any can help?