地点显示ossclas

时间:2017-03-14 18:45:22

标签: php jquery mysql ajax osclass

我使用osclass,我有这个代码用于显示区域和他们的城市。一切正常,但我需要显示区域和城市只有项目,我该怎么办?请帮助我,我是初学者。

<?php
    $aRegions = Region::newInstance()->getByCountry('AT');
    if(count($aRegions) > 0 ) { 
?>
<ul>
<?php
    foreach($aRegions as $region) {
        //print_r ($region);                    
        echo "<li>";
        //$region['pk_i_id'].
?>
        <div class="accordionButton">
            <a href="javascript:void()">
<?php echo $region['s_name']."\n"; ?>
            </a>
<?php // echo "</em>(". $region['items'].")</em>";?>
        </div>
<?php
        $aCities = City::newInstance()-> getByRegion($region['pk_i_id']);
        if(count($aCities) > 0 ) { 
            echo "<div class=\"accordionContent\">";
            echo "<ul>";
            foreach($aCities as $city)  { 
             //  print_r ($city);
                                    //$city["pk_i_id"].'
                echo "<li>";
                echo  "<a href='". osc_search_url( array( 'sRegion'=>$region["s_name"], 'sCity' => $city['s_name']  ) ) ."'> ";
                echo $city["s_name"]."\n";
                echo "</em>(". $city['items'].")</em>";
                echo "</a>";
                echo "</li>";
            }
        }
        echo "</ul>";
        echo "</li>";
    } 
?>

0 个答案:

没有答案