org/image.gif';
$attributes['class'] = 'image';
echo '
![]()
';
Chapter 12
[ 359 ]
The resultant output will appear like this:

There are additional parameters that we can use with the toString() method to
modify the output. The method uses inner and outer glue. The inner glue is used
between a key and a value; the outer glue is used between key-value pairs:
echo JArrayHelper::toString($attributes, ' : ', ";\n");
This time we use a colon for the inner glue and a semicolon and a new line character
for the outer glue. The resultant output will appear like this:
src : "http://example.org/image.gif";
class : "image"
Trees
Trees are used to model hierarchical data. Joomla! provides us with the JTree and
JNode classes; we can use these to build tree data structures. Before we start using
these classes we must import the relevant library:
jimport('joomla.base.tree');
The first thing we do when creating a new tree is to build a new JTree object.
Pages:
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500