$d3 = new d3([$hostname], [$start_port], [$end_port]);
This is the constructor that creates a new object for you to use to access a D3 server and run its Pick BASIC subroutines.
Parameter | Type | Description |
---|---|---|
$hostname | string | Hostname of D3 server. |
$start_port | integer | Starting socket port of the D3 Web Application Servers that they are listening on. |
$end_port | integer | Last socket port of the D3 Web Application Servers that they are listening on. |
$d3->fill_template($function, [$parameters], [$template]);
This function will output a file pre-merged with data fields from a Pick BASIC subroutine. Each field in the file (template) must look like <!--%key-->
Parameter | Type | Description |
---|---|---|
$function | string | Name of cataloged Pick BASIC program to call that knows how to return data for merging into a template. |
$parameters | array | Optional list of named array elements to pass to Pick BASIC program. Usually $_GET or $_POST is used. |
$template | string | Optional filename of html template to merge the returned data into. The Pick BASIC subroutine may pass back the template name but this name will override it. |
$d3->fill_array($function, [$parameters]);
This function allows you to receive a PHP array back from a Pick BASIC subroutine. It supports both string keyed (named) arrays and numeric keyed arrays. The Pick subroutine decides which of the two array types to send back.
Parameter | Type | Description |
---|---|---|
$function | string | Name of cataloged Pick BASIC program to call that knows how to return an array back to PHP. |
$parameters | array | Optional list of named array elements to pass to Pick BASIC program. Usually $_GET or $_POST is used. |
$d3->call($function, [$parameters]);
This function allows you to receive raw text data back from a Pick BASIC subroutine.
Parameter | Type | Description |
---|---|---|
$function | string | Name of cataloged Pick BASIC program to call. |
$parameters | array | Optional list of named array elements to pass to Pick BASIC program. Usually $_GET or $_POST is used. |
$d3->get_version();
Returns the version number of d3class.php, currently 1.03 as of August 13, 2005
$d3->get_hostname();
Returns the hostname of the d3 server.
$d3->get_field($key);
Returns the value of the given key in the returned data. Best when used after the $d3->extract_data() function.
$d3->get_all_fields();
Returns an array of all fields returnd from Pick BASIC subroutine.
$d3->get_basedir();
Returns the path to the base directory of the php pages. Usually set automatically when creating a new object.
$d3->get_starting_port();
Returns the first socket port number that the Pick Web Application Servers are listening on.
$d3->get_ending_port();
Returns the last socket port number that the Pick Web Application Servers are listening on.
$d3->get_error();
Returns the last error message string. Error strings stay until cleared.
$d3->clear_error();
Clears last error string. This is called implicitly on each fill_template(), fill_array(), call()
$d3->set_hostname($hostname);
Changes the hostname of the D3 server to value of the $hostname string.
$d3->set_field($key, [$value]);
Sets or changes one value of the internal data structure that is normally returned by a Pick BASIC function call. This is useful if you are only using the d3 object for generic template filling.
$d3->set_all_fields([$array]);
Sets or changes all values of the internal data structure that is normally returned by a Pick BASIC function call. This is useful if you are only using the d3 object for generic template filling.
$d3->set_basedir($dir);
Changes the path to template files to value of the $dir string.
$d3->set_starting_port($portnum);
Changes the starting socket port number of the D3 web application servers listening on.
$d3->set_ending_port($portnum);
Changes the ending socket port number of the D3 web application servers listening on.
$d3->extract_data($data);
Converts a block of textual data returned from a D3 server into its parts and stores it inside the D3 object. This is called internally by fill_template() automatically.
$d3->extract_array($data);
Converts a block of textual data returned from a D3 server into a PHP array. This is called internally by fill_array() automatically.
$d3->merge_data($template);
This function reads a template file and merges all fields found with existing data kept inside the d3 object and the results are printed (displayed). This function is called automatically by fill_template().