0

我将 Osclass 用于分类网站http://adzhome.com,我想将标题显示为“Apartment For Sale in City Area, City, Region”。我能够获取项目的地区和城市信息,但无法获取城市区域。谁能让我知道我可以用来获取市区的功能吗?

4

1 回答 1

0

粘贴下面oc-include/osclass/frm/Item.form.class.php的函数并将函数调用为

<?php ItemForm::city_area_select( CityArea::newInstance()->findByCity('3')) ; ?>.

这就是我如何在分类广告中实现城市区域http://aclassifieds.in

static public function city_area_select($citi_area = null, $item = null) {
        if( Session::newInstance()->_getForm('cityArea') != ''){
            $citi_area = null;
        } else {
            if($citi_area==null) { $citi_area = array(); };
        }
        if($item==null) { $item = osc_item(); };
        if( count($citi_area) >= 1 ) {
            if( Session::newInstance()->_getForm('cityAreaId') != "" ) {
                $item['fk_i_city_area_id'] = Session::newInstance()->_getForm('cityAreaId');
            }
            if( Session::newInstance()->_getForm('cityId') != "" ) {
                $item['fk_i_city_id'] = Session::newInstance()->_getForm('cityId');
            }

            parent::generic_select('cityAreaId', $citi_area, 'pk_i_id', 's_name', __('Select a city area..'), (isset($item['fk_i_city_area_id'])) ? $item['fk_i_city_area_id'] : null) ;
            return true ;
        } else {
            if( Session::newInstance()->_getForm('cityArea') != "" ) {
                $item['s_city_area'] = Session::newInstance()->_getForm('cityArea');
            }
            parent::generic_input_text('cityArea', (isset($item['s_city_area'])) ? $item['s_city_area'] : null) ;
            return true ;
        }
    }
于 2014-07-11T06:36:59.660 回答