Leaderboard
Popular Content
Showing content with the highest reputation on 11/24/14 in all areas
-
1 point
Использование переменных в шаблоне
XTRO reacted to Дмитрий Кондин for сообщение в теме
Возьмем для примера шаблон вывода VIP-объявлений (спец.предложений). /template/frontend/ваш_шаблон/right_special.tpl Ключевой цикл перебора вариантов находится тут {section name=i loop=$special_items2}...{/section}В процессе обхода этого цикла будет доступен следующий массив для каждой итерации {$special_items2[i]}Если нам нужно вытащить какие нибудь поля из него и вывести, например, площадь то мы можем сделать это так: {$special_items2[i].square_all}А вот можно увидеть весь массив и что в нем лежит, если в цикле вызовем это <pre> {$special_items2[i]|@print_r}</pre>Мы увидим такое: Array( [currency_code] => RUR [currency_name] => р. [price_ue] => 0 [id] => 400896 [user_id] => 1 [type_id] => 0 [topic_id] => 6143 [country_id] => 0 [city_id] => 1 [metro_id] => 32 [district_id] => 0 [street] => ВАЛОВАЯ [price] => 0 [text] => Русское описание [contact] => [date_added] => 2014-01-29 13:13:54 [agent_tel] => [room_count] => 2 [elite] => 0 [session_id] => [active] => 1 [sub_id1] => 0 [sub_id2] => 0 [reviews_count] => 0 [hot] => 1 [floor] => 10 [floor_count] => 15 [walls] => Монолит [balcony] => [square_all] => 74 [square_live] => [square_kitchen] => [bathroom] => [img1] => [img2] => [img3] => [img4] => [img5] => [img1_preview] => [img2_preview] => [img3_preview] => [img4_preview] => [img5_preview] => [is_telephone] => 1 [furniture] => 1 [plate] => нет [agent_email] => [number] => [spec] => 0 [floor_cover] => [square_room] => [is_kitchen] => 0 [region_id] => 0 [street_id] => 139 [planning] => [dom] => [flat_number] => [owner] => [source] => [adv_date] => [more1] => [more2] => [more3] => [youtube] => [fio] => [phone] => [realty_type_id] => 0 [view_count] => 38 [best] => 0 [email] => [distance] => [tmp_password] => [ad_mobile_phone] => [ad_stacionary_phone] => [can_call_start] => [can_call_end] => [currency_id] => 1 [meta_title] => аренда квартир Москва Достоевская Парковая улица (пос. Новобратцевский) [meta_description] => аренда квартир Москва Достоевская Парковая улица (пос. Новобратцевский) [meta_keywords] => аренда квартир Москва Достоевская Парковая улица (пос. Новобратцевский) [geo_lat] => 55.722469 [geo_lng] => 37.472991 [vip_status_end] => 0 [premium_status_end] => 0 [bold_status_end] => 0 [text_en] => English description [optype] => [sdfsdfs] => [complex_id] => 1 [image] => Array ( [0] => Array ( [preview] => prv533a69d43da5b_1396337108_1.jpg [normal] => img533a69d43da55_1396337108_1.jpg [type] => graphic [mime] => jpg ) [1] => Array ( [preview] => prv533a69d467dea_1396337108_2.jpg [normal] => img533a69d467de2_1396337108_2.jpg [type] => graphic [mime] => jpg ) [2] => Array ( [preview] => prv533a69d489eda_1396337108_3.jpg [normal] => img533a69d489ed3_1396337108_3.jpg [type] => graphic [mime] => jpg ) [3] => Array ( [preview] => prv533a69d4bb78e_1396337108_4.jpg [normal] => img533a69d4bb787_1396337108_4.jpg [type] => graphic [mime] => jpg ) [4] => Array ( [preview] => prv533a69d4df23d_1396337108_5.jpg [normal] => img533a69d4df233_1396337108_5.jpg [type] => graphic [mime] => jpg ) ) [expire_date] => 0000-00-00 00:00:00 [payed_adv] => 0 [manually_added] => 0 [direction] => [time_on_transport] => [time_on_foot] => [railway_station] => [not_for_agents] => 0 [haggle] => 0 [mortgage] => 0 [prepayment] => [rent_pledge] => 0 [agent_fee] => [with_pets] => 0 [with_children] => 0 [renovation] => [lot_type] => [lot_area] => [new_flat] => 0 [rooms] => 0 [rooms_offered] => 0 [open_plan] => 0 [rooms_type] => [internet] => 0 [room_furniture] => 0 [kitchen_furniture] => 0 [television] => 0 [washing_machine] => 0 [refrigerator] => 0 [bathroom_unit] => [floor_covering] => [window_view] => [building_name] => [building_type] => [building_series] => [building_state] => не выбрано [built_year] => [ready_quarter] => [lift] => 0 [rubbish_chute] => 0 [is_elite] => 0 [parking] => 0 [alarm] => 0 [ceiling_height] => [pmg] => 0 [kitchen] => 0 [pool] => 0 [billiard] => 0 [sauna] => 0 [heating_supply] => 0 [water_supply] => 0 [sewerage_supply] => 0 [electricity_supply] => 0 [gas_supply] => 0 [toilet] => не выбрано [shower] => не выбрано [cpos_id] => 0 [cuch_id] => 0 [type_sh] => arenda kvartir [company] => [city] => Москва [metro] => Достоевская [user] => Кондин Дмитрий Валерьевич [currency] => RUR [path] => arenda kvartir [date] => 29.01 [datetime] => 29.01 13:13 [topic_info] => Array ( [id] => 6143 [name] => arenda kvartir [name_en] => [active] => 0 [parent_id] => 0 [order] => 3 [sql_where] => [obj_type_id] => 0 [def_id1] => 0 [def_id2] => 0 [operation_type_id] => 0 [url] => arenda-kvartir [description] => [meta_title] => [meta_keywords] => [meta_description] => [name_am] => [name_cn] => [name_ua] => ) [parent_category_url] => arenda-kvartir/ [href] => /arenda-kvartir/realty400896 [img] => Array ( [0] => Array ( [preview] => prv533a69d43da5b_1396337108_1.jpg [normal] => img533a69d43da55_1396337108_1.jpg [type] => graphic [mime] => jpg ) [1] => Array ( [preview] => prv533a69d467dea_1396337108_2.jpg [normal] => img533a69d467de2_1396337108_2.jpg [type] => graphic [mime] => jpg ) [2] => Array ( [preview] => prv533a69d489eda_1396337108_3.jpg [normal] => img533a69d489ed3_1396337108_3.jpg [type] => graphic [mime] => jpg ) [3] => Array ( [preview] => prv533a69d4bb78e_1396337108_4.jpg [normal] => img533a69d4bb787_1396337108_4.jpg [type] => graphic [mime] => jpg ) [4] => Array ( [preview] => prv533a69d4df23d_1396337108_5.jpg [normal] => img533a69d4df233_1396337108_5.jpg [type] => graphic [mime] => jpg ) ))Если проанализировать этот массив, то можно понять, что улица у нас доступна так {$special_items2[i].street}Если нам нужны данные, которые лежат внутри вложенного массива, например, название категории, то делаем так {$special_items2[i].topic_info.name} -
1 point
Вопрос по title у странице товара(квартиры)
Дмитрий Кондин reacted to smetagenus for сообщение в теме
У меня реализовано примерно так: {if !$data}{$title}{else}{$data.topic_id.value_string} {$data.city_id.value_string} {$data.street_id.value_string}{/if} -
1 point
Вопрос по title у странице товара(квартиры)
doma reacted to Дмитрий Кондин for сообщение в теме
Код генерации title тут /apps/system/lib/frontend/view/kvartira_view.php protected function getMetaData($form_data, $hasTlocation=false, $tlocationElement=''){ require_once(SITEBILL_DOCUMENT_ROOT.'/apps/system/lib/admin/structure/structure_manager.php'); $Structure_Manager = new Structure_Manager(); $category_structure = $Structure_Manager->loadCategoryStructure(); $title=''; $meta_title=''; $meta_description=''; $meta_keywords=''; $params['topic_id']= $form_data['topic_id']['value']; $title_parts=array(); if($hasTlocation){ $title_parts[]=$this->get_category_breadcrumbs_string( $params, $category_structure, SITEBILL_MAIN_URL.'/' ); if($form_data[$tlocationElement]['tlocation_string']!=''){ $title_parts[]=$form_data[$tlocationElement]['tlocation_string']; } if(0!=(int)$form_data['price']['value']){ $title_parts[]=number_format($form_data['price']['value'],0,',',' '); } if(!empty($title_parts)){ $title=implode(', ', $title_parts); } }else{ $title_parts[]=$this->get_category_breadcrumbs_string( $params, $category_structure, SITEBILL_MAIN_URL.'/' ); if($form_data['city_id']['value_string']!=''){ $title_parts[]=$form_data['city_id']['value_string']; } if($form_data['street_id']['value_string']!=''){ $title_parts[]=$form_data['street_id']['value_string']; } if(0!=(int)$form_data['price']['value']){ $title_parts[]=number_format($form_data['price']['value'],0,',',' '); } if(!empty($title_parts)){ $title=implode(', ', $title_parts); } } if($form_data['meta_title']['value']==''){ $meta_title=$title; }else{ $meta_title=$form_data['meta_title']['value']; } if($form_data['meta_description']['value']!=''){ $meta_description=$form_data['meta_description']['value']; } if($form_data['meta_keywords']['value']!=''){ $meta_keywords=$form_data['meta_keywords']['value']; } return array( 'title'=>$title, 'meta_title'=>$meta_title, 'meta_description'=>$meta_description, 'meta_keywords'=>$meta_keywords ); } -
1 point
Вопрос по title у странице товара(квартиры)
kmavega reacted to smetagenus for сообщение в теме
atrox, здравствуйте. Насколько я знаю, title для обЪявления формируется здесь - apps\system\lib\frontend\view\kvartira_view.php. Чтобы его не ковырять, можете прямо в шаблоне вместо {$title} использовать нужные вам переменные - {$data.city_id.value_string}, {$data.street_id.value_string} и другие.