SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 375 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"


We can use this example in conjunction with the previous example in order to output
each album and its track listing. This example demonstrates what the resultant
output could look like once some CSS has been applied:
Editing
In addition to interrogating XML data, we can modify data. Imagine we want to add
a new album to the catalogue. We need to use the addChild() method; this method
adds a new sub-node of a specified type and returns a reference to the new node:
$newAlbum =& $document->addChild('album');
Now that we have added the new album node, we need to add to the album the child
nodes title, artist, year, and tracks:
$title =& $newAlbum->addChild('title');
$artist =& $newAlbum->addChild('artist');
Chapter 10
[ 283 ]
$year =& $newAlbum->addChild('year');
$tracks =& $newAlbum->addChild('tracks');
The first three of these nodes require us to set the data values. Unfortunately,
we can't do this when we create the node; we must do this afterwards using the
setData() method:
$title->setData('Green Onions');
$artist->setData('Booker T.


Pages:
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387
druga wojna światowa Free English grammar and study guid hotel jelenia góra Russian bride counter strike 1.6