RE: [PHP-DEV] PHP-sablotron
| From: | Mike Robinson | Date: | Fri, 01 Sep 2000 15:49:01 +0000 |
| Subject: | RE: [PHP-DEV] PHP-sablotron | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-31590@lists.php.net to get a copy of this message | ||
Hi guys,
I dislike very much making suggestions that add to a workload,
especially since you two already make significant contributions
to php, but if the entire process of implementing the sablotron
[or alternative] extension were documented, it'd make an
extremely useful how-to/article on extending php functionality.
Regards
Mike Robinson
> Actually this seems quite easy, just:
>
> PHP_FUNCTION(xslt_output_transform)
> {
> zval **file;
> SABOTLS_FETCH();
>
> if (ZEND_NUM_ARGS() != 1 ||
> zend_get_parameters_ex(1, &file) == FAILURE) {
> WRONG_PARAM_COUNT;
> }
>
> SABLOTG(output_transform_file) = estrndup(Z_STRVAL_PP(file),
>
> Z_STRLEN_PP(file));
> php_start_ob_buffer();
> }
>
> PHP_FUNCTION(xslt_output_endtransform)
> {
> char *result;
> int ret = 0;
> OLS_FETCH();
> SABLOTLS_FETCH();
>
> if (OG(nesting_level) == 0) {
> RETURN_NULL();
> }
>
> char *arguments[] = {
> "/_xmlinput", OG(active_ob_buffer).buffer,
> "/_output", NULL
> };
>
> ret = SablotProcess(SABLOTG(output_transform_file),
> "arg:/_xmlinput", "arg:/_output", NULL,
> arguments, &result);
>
> if (ret) {
> /* Sablot Error Handling */
> if (SABLOTG(output_transform_file)
> efree(SABLOTG(output_transform_file));
> RETURN_NULL();
> }
>
> PUTS(result);
> php_end_ob_buffer(0);
> efree(SABLOTG(output_transform_file));
> if (resutl)
> SablotFree(result);
> }
>
> Off the top of my head...