<?php $faqs=loadTextMap('faq',4); $faqmap=array(); foreach ($faqs as $key=>$text) { list($no,$type)=explode('.',$key); $faqmap[0+$no][$type]=$text; } ksort($faqmap); $dataset['FAQ']=array(); foreach ($faqmap as $no=>$qa) { array_push($dataset['FAQ'], array( 'no'=>$no, 'question'=>$qa['q'], 'answer'=>$qa['a'], 'name'=>$qa['n']?$qa['n']:$no ) ); } ?>