Controlled climate in the plant chamber',
76, 'Les Politiques de la communication en Yougoslavie^zfre',
'author', 'Franco, C.M.',
26, $subs,
// a field to test del
77, 'ave Caesar',
// a field using tab as subfield separator
42, "foo\tbar\tbaz",
// a field containing newline
99, "two\nlines",
// a serialized record (as of toString) as parameter
"70\tyet another author\n99two more\n\tlines\na 0 field\n42\tthe\tanswer"
);
// dump the stuff
?>
dump of record
have =$r->len()?> fields
--
=htmlspecialchars($r->toString())?>--
examples of field selector
tag); // print_r corrupts data with 4.3.1
// print_r($r->map());
$r->del( 77 ); // ... morituri te salutant
// various examples how to access fields
foreach ($db->fdt as $name => $tag)
while ($v = $r->mhl($tag))
echo "$name = $v
\n";
?>
v26^a = =$r->h(26,'^a')?>
res();
// more convenient to get them all at once
// the same as Isis_rec::fmt($r->v(26),'&^abc'),
foreach ($r->h(26,'^abc') as $k => $v)
echo "v26^$k = $v
\n";
?>
v69 = =$r->mhl('keywords')?>
v76 = =$r->mhl(76)?>
v42(1) = =$r->h(42,'(1)')?>
formats returning arrays on '$subs'\n";
foreach (array(
'&^cab(..',
'&^*(..',
'&^(..',
'&^bca(1..',
'&MHL^cab(..'
) as $fmt) {
echo "\n\nFormat "$fmt"
\n";
foreach (Isis_rec::fmt($subs,$fmt) as $k => $v)
echo "v26^$k = $v
\n";
}
?>
embedding and TEXT mode
embed( 22, $r );
$s = $q->toString(ISIS_REC_TEXT);
echo "record embedded as field 22
\n---\n$s---\n
\n";
$q->del();
// restore from the string
$q->parse( $s, ISIS_REC_TEXT );
// extract the original r
$r = $q->v( 22, 0 );
$r->db = $db;
echo "record restored from field 22
\n",
"---\n", $r->toString(), "---\n
\n";
?>
set operator
set( 'title', 'new title', 'second new title' );
// change 99s, removing one
$r->set( 99, 'now a oneliner' );
// change author[1] only, also test array parameter
$r->set( 'author', array(1, 'Blanco', 0) );
echo "---\n", $r->toString(), "---\n
\n";
?>
talking to echo server
Unfortunately, PHP GET/POST based echo server can not preserve field order.
request( $r );
if ( $res )
echo "\n---\n", $res->toString(), "---
\n";
else
echo "failed\n";
?>