Easy.
If the configuration option name is "configuration_name" and the configuration value is $value, use this syntax:
PHP Code:
ExtDirect::$configuration_name = $value;
And that's all.
Now, let's see the available configuration options:
- name: api_classes
- type: array of strings
- meaning: Name of the classes to be published to the Ext.Direct API
- default: empty
- comments: This option is overriden if you provide a non-empty $api_classes parameter for the "ExtDirect::provide" method. Choose one or another. If you want to declare a single class, you can set $api_classes as a string, instead of an array.
- example
PHP Code:
ExtDirect::$api_classes = array( 'Server', 'OtherClass', 'StoreProvider' );
- name: url
- type: string
- meaning: Ext.Direct API attribute "url"
- default: $_SERVER['PHP_SELF']
- comments: Sometimes, PHP_SELF is not what we want. So, it is possible to specify the API URL manually.
- example
PHP Code:
ExtDirect::$url = '/path/to/my_php_script.php';
- name: namespace
- type: string
- meaning: Ext.Direct API attribute "namespace"
- default: "Ext.php"
- comments: Feel free to choose your own namespace, according to ExtJS rules for it.
- example
PHP Code:
ExtDirect::$namespace = 'Ext.Dharma';
- name: descriptor
- type: string
- meaning: Ext.Direct API attribute "descriptor"
- default: "Ext.php.REMOTING_API"
- comments: Feel free to choose your own descriptor, according to ExtJS rules for it, and to the chosen namespace.
- example
PHP Code:
ExtDirect::$descriptor = 'Ext.Dharma.REMOTING_API';
- name: count_only_required_params
- type: boolean
- meaning: Set this to true to count only the required parameters of a method for the API "len" attribute
- default: false
- example
PHP Code:
ExtDirect::$count_only_required_params = true;
- name: include_static_methods
- type: boolean
- meaning: Set this to true to include static methods in the API declaration
- default: false
- example
PHP Code:
ExtDirect::$include_static_methods = true;
- name: include_inherited_methods
- type: boolean
- meaning: Set this to true to include inherited methods in the API declaration
- default: false
- example
PHP Code:
ExtDirect::$include_inherited_methods = true;
- name: instantiate_static
- type: boolean
- meaning: Set this to true to create an object instance of a class even if the method being called is static
- default: false
- example
PHP Code:
ExtDirect::$instantiate_static = true;
- name: constructor_send_params
- type: boolean
- meaning: Set this to true to call the action class constructor sending the action parameters to it
- default: false
- example
PHP Code:
ExtDirect::$constructor_send_params = true;
- name: debug
- type: boolean
- meaning: Set this to true to allow exception detailed information in the output
- default: false
- example
PHP Code:
ExtDirect::$debug = true;
- name: utf8_encode
- type: boolean
- meaning: Set this to true to pass all action method call results through utf8_encode function
- default: false
- example
PHP Code:
ExtDirect::$utf8_encode = true;
- name: default_api_output
- type: string
- meaning: API output format - available options are "json" (good for Ext Designer) and "javascript"
- default: "json"
- comments: Another way to enforce "javascript" output is to append the "?javascript" query string in the end of your PHP script URL; do this in the HTML <script> tag that refers to your API
example
PHP Code:
ExtDirect::$default_api_output = "javascript";