You are here

public function QPList::appendList in QueryPath 6

Same name and namespace in other branches
  1. 7.3 QueryPath/Extension/QPList.php \QPList::appendList()
  2. 7.2 QueryPath/Extension/QPList.php \QPList::appendList()

File

QueryPath/Extension/QPList.php, line 58

Class

QPList

Code

public function appendList($items, $type = self::UL, $options = array()) {
  $opts = $options + array(
    'list class' => 'qplist',
  );
  if ($type == self::DL) {
    $q = qp('<?xml version="1.0"?><dl></dl>', 'dl')
      ->addClass($opts['list class']);
    foreach ($items as $dt => $dd) {
      $q
        ->append('<dt>' . $dt . '</dt><dd>' . $dd . '</dd>');
    }
    $q
      ->appendTo($this->qp);
  }
  else {
    $q = $this
      ->listImpl($items, $type, $opts);
    $this->qp
      ->append($q
      ->find(':root'));
  }
  return $this->qp;
}