2016-04-15 44 views
0

剧本osclasssOsclass下拉选择城市在搜索insted的类别选择

这是原来的代码

?php if (osc_count_categories()) { ?> 
      <div class="cell selector"> 
       <?php osc_categories_select('sCategory', null, __('Select a category', 'bender')) ; ?> 
      </div> 
      <div class="cell reset-padding"> 
     <?php } else { ?> 
      <div class="cell"> 
     <?php } ?> 
      <button class="ui-button ui-button-big js-submit"><?php _e("Search", 'bender');?></button> 
     </div> 

如何修改这个代码,以使用户选择一个城市搜索不是一个类别?

谢谢大家。

回答

0

我找到了解决办法=) 由于https://stackoverflow.com/users/3465265/key

只需添加该代码

<?php $aCities = City::newInstance()->listAll(); ?> 
<?php if(count($aCities) > 0) { ?> 
<select name="sCity" id="sCity"> 
<option value=""><?php _e('Select a city...')?></option> 
    <?php foreach($aCities as $city) { ?> 
    <option value="<?php echo $city['s_name'] ; ?>"><?php echo $city['s_name'] ; ?></option> 
    <?php } ?> 
</select> 
<?php } ?>