[Yazlist] Modifications on PHP/YAZ "complete"

Christoffer Landtman landtman at realnode.fi
Tue Jan 13 13:29:18 CET 2004

Dear all,

The previously discussed modifications are now completed, and can be 
found in the attached patch.

The modifications contain 3 new functions, all accessible via and 
object; when running yaz_record, "object" is the trigger to submit to 
get access to all these functions. Here are some small examples:

$obj = yaz_record($id[$i],$p,"object");
$record = $obj->field("020", "a");
$cfield = $obj->cfield('001');
$ffield = $obj->ffield("020", "ISBN: %a is good!");
print "RESULT FROM FFIELD: ".$ffield;

which will result in the following output:

GRS Class Object
     [handle] => Resource id #3
     [a] => 9515013062
     [@] => 0000000005
RESULT FROM FFIELD: ISBN: 9515013062 is good!

The functions are as follows:

array field(string field, string subfield)
array cfield(string controlfield)
string ffield(string field, string syntax)

field and cfield are just fetching functions that will return arrays 
with matches, whereas ffield is a bit more advanced and could in an 
operative sense be compared with printf(), however with the difference 
that You submit the field-code instead of what type You expect.

This is the first "draft" of the modifications, and it is very possible 
that the new functions may break under special conditions.

There is one noticeable limitation in the current setup, which is that 
the longest formatted string that can be is 1024 characters. This was 
intended to be dynamic, i.e. growing, but we were not able to figure out 
a way that did not result in a segmentation fault of some other 
component of the PHP/YAZ module.

A note to the authors of the PHP/YAZ module that hopefully will look at 
the modifications is that the modifications have been made on a 
regrettably old version of the module (, and might as such be a 
pain to implement in recent versions. We tried to generate a patch 
against the most recent release, but this, as expected did result in a 
terrible mess, and as such we sincerely hope that You might have some 
more powerful tools to compare (e.g. CVS). The attached patch is as such 
against version of the module, and in case You cannot make any 
sense of the patch, I will have to manually generate a better patch.

Please comment on the modification, and feel free nag on approaches made 
in the module. I will certainly not feel offended as this is the first 
PHP-module I have ever done, and neither are my C-coding skills anything 
to brag with...=)

I hope some of You will find these modifications as useful as we have 
seen them to be in the future versions of Emilda [1]

Best regards,

[1] http://emilda.org

Christoffer Landtman
Oy Realnode Ab
Partner, Sales
+358 (0)41 510 1073
landtman at realnode.fi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: php_yaz.c.patch
Type: text/x-patch
Size: 10812 bytes
Desc: not available
Url : http://lists.indexdata.dk/pipermail/yazlist/attachments/20040113/8920ea58/php_yaz.c.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: php_yaz.h.patch
Type: text/x-patch
Size: 630 bytes
Desc: not available
Url : http://lists.indexdata.dk/pipermail/yazlist/attachments/20040113/8920ea58/php_yaz.h.bin

More information about the Yazlist mailing list