[Yazlist] PHP/YAZ GRS-1 record array, can you get the tag name?

Galium ksanders at sandnarrows.com
Wed Oct 10 18:25:00 CEST 2001


Is there a method of getting the tag name from the GRS-1 record array tuple?
For example you can get the tagpath with
$ar[$key][0] and the data with $ar[$key][1]

How could you get the tag name rather then the path?

Thanks,

Ken Sanderson


> I have been working with one of the examples and I had a question or two,
> specifically about the following function:
>
> function print_structured_record($ar) {
>     reset($ar);
>     while(list($key,list($tagpath,$data))=each($ar)) {
>         echo $tagpath . $data . "<br>\n";
>     }
> }
>
> The array that comes back from a search, specifically a grs-1 search is
fed
> into this function in the mult.php example. Its all fairly clear, my
> question is about the list(list())? Is the array coming from the
yaz_search
> function a two dimensional array? If it is, then in theory if I took the
> values of $key and $tagpath I should be able to extract the items from the
> array outside of the while loop? For example if I had a known $key of 21
and
> a $tagpath of (3,15)(3,70)(3,71), shouldnt I be able to do a:
> $ar[21][(3,15)(3,70)(3,71)] ?
>
> Is this correct? I havent been able to get it to work, but it could be
that
> I am not commenting out that messy tagpath appropriately.

The value of the outer index (say 21 in your example) is a tuple, where
first item, corresponding to index 0, is the tagpath and second tuple
is the data. Hence, $ar[21][0] = "(3,15)(3,70)(3,71)" and $ar[21][1] =
"some data".

Admitted, the documentation and/or examples could be more clear on
this topic.

Cheers,
  Adam




More information about the Yazlist mailing list