PHP-Fusion
v.7.01
AP-Fusion
v7.02.05
Pimped-Fusion-AP
v0.09.03
September 21 2018 20:17:18
Авторизация
Логин

Пароль



Вы не зарегистрированы?
Нажмите здесь для регистрации.

Забыли пароль?
Запросите новый здесь.
Мини-чат
Вы должны авторизироваться, чтобы добавить сообщение.

lom
06/04/2018 14:03
Мы рады, ждем девятку. Очень хочется пощупать

Alipapa
27/03/2018 22:16
Всем привет, все неисправности устранили, всё у нас работает

mukaton
30/10/2015 02:37
Не получается ничего скачать. Ошибка Not Found

Alipapa
06/10/2015 23:00
9-я версия php-fusion на подходе, следите за новостями

Alipapa
10/11/2014 11:24
Заметь, я дважды ответил через 3 минуты после вопроса, могли бы уже решить

Последние статьи
· О стабилизаторах нап...
· СМС и Вебмани
· TinyMCE для пользова...
· PCRE (Perl Compatibl...
· PCRE (Perl Compatibl...
Последние активные темы форума
  Темы Просмотров Ответов Последние сообщения
Php-Fusion v9. Первые впеча...
Вопросы по работе
232 3 Vveb--ws
25-07-2018 13:46
Появился хэлп по PHP-Fusion...
Вопросы по работе
2313 7 Vveb--ws
25-07-2018 13:42
PHP-Fusion 7 Bogatyr - бесп...
Моды, плагины
70 0 Vveb--ws
25-07-2018 13:39
prestashop&ap-fusion
Вопросы по работе
9767 61 Alipapa
26-08-2014 10:29
Плагин магазина Ap-Shop
Моды, плагины
6235 70 Alipapa
18-08-2014 18:14
TinyMCE
Вопросы по работе
13806 55 Alipapa
27-07-2013 21:57
HTML-5
Моды, плагины
1929 1 Alipapa
15-06-2013 19:47
Мультиязычность в Pimped-Fu...
Ошибки, баги, глюки
2792 4 Papich
16-04-2013 12:39
Pimped-Fusion. Первые впеча...
Ошибки, баги, глюки
12742 127 Alipapa
18-12-2012 10:59
Ищу мод для расстановки код...
Моды, плагины
8462 55 Alipapa
17-09-2012 14:00
Как присоединить файл к лич...
Моды, плагины
5042 3 lom
27-05-2012 18:12
Что мне не нравится в после...
Вопросы по работе
3298 4 Alipapa
27-05-2012 18:08
Проблемы с добавлением кате...
Вопросы по работе
4046 5 Alipapa
27-05-2012 18:06

yaz_record

(PHP 4 >= 4.0.1, PHP 5)

yaz_record -- Returns a record

Description

string yaz_record ( resource id, int pos, string type )

Returns the record at position pos or an empty string if no record exists at the given position.

The yaz_record() function inspects a record in the current result set at the position specified by parameter pos. If no database record exists at the given position an empty string is returned.

Record positions in a result set are numbered 1, 2, ... $hits where $hits is the count returned by yaz_hits().

The type specifies the form of the returned record.

string

The record is returned as a string for simple display. In this mode, all MARC records are converted to a line-by-line format since ISO2709 is hardly readable. XML records and SUTRS are returned in their original format. GRS-1 are returned in a (ugly) line-by-line format.

This format is suitable if records are to be displayed in a quick way - for debugging - or because it is not feasible to perform proper display.

xml

The record is returned as an XML string if possible. In this mode, all MARC records are converted to MARCXML. XML records and SUTRS are returned in their original format. GRS-1 is not supported.

This format is similar to string except that MARC records are converted to MARCXML

This format is suitable if records are processed by an XML parser or XSLT processor afterwards.

raw

The record is returned as a string in its original form. This type is suitable for MARC, XML and SUTRS. It does not work for GRS-1.

MARC records are returned as a ISO2709 string. XML and SUTRS are returned as strings.

syntax

The syntax of the record is returned as a string, i.e. USmarc, GRS-1, XML, etc.

database

The name of database associated with record at the position is returned as a string.

array

The record is returned as an array that reflects the GRS-1 structure. This type is suitable for MARC and GRS-1. XML, SUTRS are not supported and if the actual record is XML or SUTRS an empty string will be returned.

The array returned consists of a list corresponding to each leaf/internal node of GRS-1. Each list item consists a sub list with first element path and data (if data is available).

The path which is a string holds a list of each tree component (of the structured GRS-1 record) from root to leaf. Each component is a tag type, tag value pair of the form (type, value

String tags normally has a corresponding tag type 3. MARC can also be returned as an array (they are converted to GRS-1 internally).

Замечание: It is the application which is responsible for actually ensuring that the records are returned from the Z39.50/SRW server in the proper format. The type given only specifies a conversion to take place on the client side (in PHP/YAZ).

Besides conversion of the transfer record to a string/array, PHP/YAZ it is also possible to perform a character set conversion of the record. Especially for USMARC/MARC21 that is recommended since these are typically returned in the character set MARC-8 that is not supported by browsers, etc. To specify a conversion, add ; charset=from, to where from is the original character set of the record and to is the resulting character set (as seen by PHP).

Пример 1. Array for GRS-1 record

Consider GRS-1 record

(4,52)Robert M. Pirsig
(4,70)
 (4,90)
       (2,7)Transworld Publishers, ltd.
This record has two nodes at root level. First element at root level is (4,52) [tag type 4, tag value 52], and has data Robert M. Pirsig. Second element at root level (4,70) has a subtree with a single element (4,90). (4,90) has yet another sub tree (2,7) with data Transworld Publishers, ltd..

If this record is present at position $p, then

$ar = yaz_record($id, $p, "array");
print_r($ar);
produces
Array
(
    [0] => Array
   (
       [0] => (4,52)
       [1] => Robert M. Pirsig
   )
    [1] => Array
   (
       [0] => (4,70)
   )
    [2] => Array
   (
       [0] => (4,70)(4,90)
   )
    [3] => Array
   (
       [0] => (4,70)(4,90)(2,7)
       [1] => Transworld Publishers, ltd.
   )
)

Пример 2. Working with MARCXML

The following PHP snippet returns a MARC21/USMARC record as MARCXML. The original record is returned in marc-8 (unknown to most XML parsers), so we convert it to UTF-8 (which all XML parsers must support).

$rec = yaz_record($id, $p, "xml; charset=marc-8,utf-8");

The record $rec can be processed with the Sablotron XSLT processor as follows:

$xslfile = 'display.xsl';
$processor = xslt_create();
$parms = array('/_xml' => $rec);
$res = xslt_process($processor, 'arg:/_xml', $xslfile, NULL, $parms);
xslt_free($processor);
$res = preg_replace("'</?html[^>]*>'", '', $res);
print $res;

For PHP 5 the XSL extension can be used instead of Sablotron XSLT.

Все функции PHP:
Навигация
· Новости
· Статьи
· Скачать
· Форум
· Ссылки
· Категории новостей
· Обратная связь
· Галерея
· Поиск
· CMS AP-Fusion. Отличия от PHP-Fusion
· Javascript справочник
· Техника
Сейчас на сайте
· Гостей: 1

· Пользователей: 0

· Всего пользователей: 453
· Новый пользователь: ZDA
Информеры
Загрузка файлов  +  -
7,734,918 уникальных посетителей Iceberg by Harly