【问题标题】:Osclass how to fetch the city area information of an itemosclass如何获取一个item的市区信息
【发布时间】:2014-07-09 13:36:50
【问题描述】:

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

【问题讨论】:

    标签: seo bing osclass


    【解决方案1】:

    将下面的函数粘贴到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 ;
            }
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-07
      • 2023-03-23
      • 2020-10-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多