我在一个对话框中有两个列表 - 一个气泡计数列表和一个拇指列表。气泡计数列表看起来不错,但拇指列表显示为单独的列表项。
我不习惯以这种方式编写 html 输出,也许我缺少一些简单的东西。气泡计数列表的代码在“//将电影文件夹分配给孩子”下方,拇指列表的代码在“//显示图像计数,编码 url 路径”下方:
private function _makeoutput($folder_index) {
$html = '';
$query = 'dir§'.$this->session->userdata('uid').'§'.$folder_index;
//api query, create listview for images
if($xml = $this->api->query($query)){
$xml = simplexml_load_string($xml);
$html .= '<ul data-role="listview" data-inset="true" text-align:center;>';
//assign movie folders to child
foreach($xml->COM->MOVIE_FOLDER as $child){
$html .= '<li>';
//count number of images in each root folder
$bubble_count = $child->MOVIE->count();
$html .= '<a href="'.$child->attributes()->indexI.'" data-rel="dialog" data-transition="slide">'.$child->attributes()->nameS.'<span class="ui-li-count">'.$bubble_count.'</span></a>';
$html .= ' </li>';
}
$html .= '</ul>';
//display image count, encode url/path
for($i = 0, $c = $xml->COM->MOVIE->count(); $i < $c; $i++ ){
$html .= '<ul data-role="listview" class="ui-listview" data-inset="true">';
$html .= '<li>';
$html .= '<a>
<img src="https://[url]'.rawurlencode($this->_decode_path($xml->COM->MOVIE[$i]->attributes()->dbIcoFilename)).'" id="imgThumb" alt="'.$xml->COM->MOVIE[$i]->attributes()->nameS.'" />
<h1>'.$xml->COM->MOVIE[$i]->attributes()->nameS.'</h1>
</a>';
$html .= ' </li>';
$html .= '</ul>';
}
}
else{
$data['output'] = $this->_makeoutput($folder_index);
}
return $html;
}